-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add different configuration for different files #3767
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
Comments
Although you're describing a slightly different use case, I'm closing this in favour of #618 because once that's implemented it would be the way that we would recommend solving your use case. |
I don't think #618 solve this issue. There are many reason where we do not want test to be located in a separate repository for example:
|
@AWhetter is re-opening this possible? I'd like to be able to configure pylint to ignore test files the way @Conchylicultor described. i wouldn't think pylint should be prescriptive of "whether test files are stored in standalone I would hope that instead we would see a configurable flags for such as something like
|
@BrettMoan this option already exists, see
or |
I don't want to ignore the test filles. But apply different I agree that pylint shouldn't impose were tests filles are stored. |
If a googler want to contribute to pylint it would be very welcome. A lot of googler already did ! From where I'm at, the per-directory configuration is something that has been planned for a long time, and it's not implemented yet because we do not have enough contributors willing to take time to implement it. The per-file configuration seems a step above that, so it's unlikely to be done in the short term unless a new contributor does it. |
I personally do not think we really need different configuration for different files but we need wildcards for disabling rules, like flake8. They call the option See https://github.com/ansible-community/ansible-lint/blob/main/.flake8#L49-L62
That is kinda essential for enabling progressive improvement of codebase. You might have hundreds of thousands of problems to fix on a project and you likely want to fix them gradually.... while preventing addition of new code that is not compliant. Touching lots of files to add in-place disable does not really scale well. |
For that we have #5403 |
@ssbarnea I really wanted per-file-ignores to avoid having to had a I copied a bit of code from the Here's how I did it: Updates to
|
Got excited and ended up making a python package with this so I can use it in a few other projects.. |
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe
This request is similar request to #618 (Add different configuration for different sub directories) but at the file level.
Currently,
pylint
apply the same config instinctively to all files. However some rules should be applied only to specific files.For instance it is really frequent in test files to access private members (
assert module._some_fn()
). Currently all our tests files trigger hundreds ofprotected-access
warnings.Describe the solution you'd like
We would like a way to overwrite specific rules for all
*_test.py
files.For instace being able to register some
pattern="**/*_test.py"
with custom rules associated. All files which would match the pattern would use the special pylint rules.Note: if the pattern accept directory names (
some_dir/**
), it would also solve #618 while being more flexible (like:**/some_dir/**
).The text was updated successfully, but these errors were encountered: