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

Allow fne-grain control of bad-whitespace warnings #246

Closed
pylint-bot opened this issue May 13, 2014 · 5 comments · Fixed by #3577
Closed

Allow fne-grain control of bad-whitespace warnings #246

pylint-bot opened this issue May 13, 2014 · 5 comments · Fixed by #3577
Labels
Enhancement ✨ Improvement to a component

Comments

@pylint-bot
Copy link

Originally reported by: Edd Barrett (BitBucket: vext01, GitHub: @vext01?)


It would be neat if it was possible to have more control over the bad-whitespace warnings.

For example, consider the following:

j = [ x for x in y if x > 4 ]
def myfunc(a,b,c):
    ...

bad-whitespace is fired because:

  • There is a space after the opening [
  • There is a space before the closing ]
  • There is no space after the commas separating function parameters.

Ideally I would like to disable the first two warnings whilst retaining the third. Currently bad-whitespace covers all of the above warnings. It would be neat to have a bad-whitespace-listcomps, bad-whitespace-paramcommas, ...

What do you think?

Thanks :)


@pylint-bot
Copy link
Author

Original comment by BitBucket: rneu31, GitHub: @rneu31?:


I agree completely. I have a specific use case for avoiding the bad-whitespace warning for requiring one space after a comma.

I am doing C/C++ Unit Tests using an in house framework where I want to align the columns of inputs. I have written a currently in house wrapper for Pylint and pep8 tools that will soon have some configuration options for which use case the tool is invoked for.. I.E Python source code or C/C++ Unit Tests. I would like to be able to disable the specific error for the case where I am running Pylint across a Unit Test.

#!python

case_list = [
    ('description here',
     0x1234, 0x3459, False, True, '0xABCD'),

    ('description here',
     0,      1,      2,     3,    4
]

@pylint-bot pylint-bot added the Enhancement ✨ Improvement to a component label Dec 9, 2015
@PCManticore PCManticore added this to the 2.3 milestone Jun 29, 2016
@darksuji
Copy link

Another case that belongs in its own warning class is spaces in kwargs.

def f(i = 0):

and

f(i = 4)

both trigger bad-whitespace. Accordingly, you can't use spaces in kwargs unless you're also willing to turn off warnings telling you to use spaces around non-kwargs-associated operators.

@moylop260
Copy link
Contributor

There is a pep related with this request?

@PCManticore
Copy link
Contributor

What do you mean by a PEP? This issue is about having the ability to ignore certain classes of errors regarding bad-whitespace. While we might enforce PEP8 by default, which we fully don't, having the ability to configure pylint to your own style is pretty valuable.

@moylop260
Copy link
Contributor

I got it
Thank for clarify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants