-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Negation of per-file-ignores not working as expected #13716
Comments
Can you tell me a bit more about what exactly isn't working? For which files is You might want to consider using |
Hey @MichaReiser, Sorry for the delay. I want TID0251 to be enabled in every project inside abc folder and disable otherwise. I'm not sure what ruff does about the path that is used for those exclusions when a config file is passed, but it appears to be using the relative path instead of the absolute path. For instance, I have a project inside abc, let's call it xpto, that has a src folder inside. |
That makes sense. Did you try using |
Yes, I tried |
Can you share an example project? I created a project with:
[tool.ruff.lint.per-file-ignores]
"!abc/**/*.py" = ["TID251"]
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"os".msg = "We don't want to rely on any platform specific code" And ruff correctly flags |
Let's assume that the project is somewhat like this:
And what is specified in the config.toml is (I do not have the ruff configurations on a pyproject.toml by project):
And the tool that calls ruff is calling it:
|
I'm not sure if The easiest here might actually be to make use of ruff's configuration inheritance feature where:
That should also remove the need to call ruff with an explicit config parameter because it will automatically pick up the closest |
Hey everyone,
I have a monorepo where I am using the banned-api from flake8-tidy-imports to block the usage of an import of a certain package. However, I only want this to work inside the projects that are inside a folder called abc. I am trying to use the per-file-ignores
configuration, in a config file that I use globally across the repo, with the following:
However, this appears not to be working. Am I doing something wrong?
The text was updated successfully, but these errors were encountered: