Avoid implicit string concatenation

Missing commas in tuples results in implicit string concatenation. Probably not what you intended to do.

Implicit string concatenation that resulted from a typo can change the behaviour of the application. Take for example:

is_positive('agreed') evaluates to False because a typo resulted in the comma being missed from the end of 'affirmative', resulting in 'affirmative' and 'agreed' being implicitly concatenated to 'affirmativeagreed'.

If our GitHub code review bot spots this issue in your pull request it gives this advice:

code-review-doctorbotsuggested changes just now
validation.py
1
+
values = (
2
+
    'yes',
3
+
    'correct'
Suggested changes
-
    'correct'
+
    'correct',
Expand 2 lines ...
Commit suggestion

Missing commas in tuples results in implicit string concatenation. Probably not what you intended to do.

Read more
4
+
    'agreed',
5
+
)
Update validation.py
We're your Python code review copilot. Get code improvements right in your pull request with our GitHub code review bot.

Configuring this check

Code Review Doctor will run this check by default. No configuration is needed but the check can be turned on/off using check code avoid-missing-comma in your pyproject.toml file.

Read more about configuring Code Review Doctor.

Reading list