Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing comma in list values lint #1589

Closed
VFLashM opened this issue Jul 24, 2017 · 4 comments
Closed

Missing comma in list values lint #1589

VFLashM opened this issue Jul 24, 2017 · 4 comments

Comments

@VFLashM
Copy link

VFLashM commented Jul 24, 2017

Steps to reproduce

DATA = [
    'a',
    'b' # missing comma
    'c',
    'd',
]

Current behavior

No warning

Expected behavior

It should probably be reported.
String values get silently concatenated because of missing comma. This is most certainly not what user wanted or expected.

pylint --version output

pylint 1.7.2,
astroid 1.5.3
Python 2.7.12 (default, Sep 20 2016, 14:05:04)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]

@PCManticore
Copy link
Contributor

The problem with this check is that it can result in a lot of false positives. How should you figure out that the string concatenation is not implicitly required? We also use this pattern a lot in our codebase for example and this check will emit on those instances as if they are problematic, which in fact is not.

@VFLashM
Copy link
Author

VFLashM commented Jul 24, 2017

Do you have such implicit string concatenation in list values or just somewhere in code?
I'm talking specifically about lists.

I can argue that it would be not a false positive, but a code smell.
For example, single character variables are not problematic on their own, but they are linted nonetheless.

@PCManticore
Copy link
Contributor

In tuples. But the principle remains. Why should we warn about lists and not about tuples?

@VFLashM
Copy link
Author

VFLashM commented Jul 24, 2017

Yes, it stands for tuples too. I meant that stray values are more or less safe.

heilaaks added a commit to heilaaks/snippy that referenced this issue Dec 6, 2018
Test case accidentally concatenated [1] list values which
was noticed with the latest Pylint 2.2.2.

[1] pylint-dev/pylint#1589

Signed-off-by: Heikki Laaksonen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants