pep8-naming icon indicating copy to clipboard operation
pep8-naming copied to clipboard

ignore-names does not apply for all checks

Open igorraush opened this issue 8 years ago • 5 comments

Unless I'm missing something, the ignore argument to the visitor methods is used only in FunctionNameCheck (N802). Is this by design? Would be great to apply this option for all checks.

igorraush avatar Aug 22 '17 19:08 igorraush

I'd merge a pull request that implements this. I suspect the reasoning is that the implementor didn't want --ignore-names to be overly broad. Perhaps we should deprecate that option in favor of ignore-function-names and ignore-class-names etc. so that people can be specific.

sigmavirus24 avatar Aug 26 '17 13:08 sigmavirus24

@sigmavirus24 Judging by the first comment in https://github.com/PyCQA/pep8-naming/pull/19, the implementer submitted a partial WIP, intending to apply the logic to all error types. That said, I do agree with you that type-specific whitelists would be useful. So you'd like to continue supporting ignore-names with the current behavior but start emitting a DeprecationWarning, and implement ignore-*-names? I'd be happy to submit a PR.

igorraush avatar Aug 27 '17 15:08 igorraush

Another discussion point: how granular should the options be? Ideally, there should be an option to ignore a list of names for each error type. One way to do it:

  • ignore-function-names (applies to N802)
  • ignore-class-names (applies to N801)
  • ignore-variable-names (applies to N803, N806, N81x)
  • ignore-Nxx-names (applies to Nxx specifically)

Another approach entirely (similar to something suggested in the original PR) is to support

--ignore-names X N803:Y N804:mcs`

which would suppress all errors about X (class, function, etc.), N803 about Y, etc.

What are your thoughts?

igorraush avatar Aug 27 '17 18:08 igorraush

We don't have a reverse mapping of violation code to checker class and I'd rather not build one or attempt to maintain it. Using explicitly named flags without using weird magical syntax makes the most sense. It's simple, explicit, and can be easily configured in INI.

sigmavirus24 avatar Aug 27 '17 19:08 sigmavirus24

ignore-names now also applies to N806, N815, and N816 checks as of #96.

jparise avatar Jan 28 '19 20:01 jparise