Is there a way to use a different configuration for tests than for the rest? #4119
-
We would like to not exclude our tests directory completely however some rules make sense for "production code" but not for tests. An Example of this is S101 flagging the use of Is there a way to use directory specific configurations of which rules to use/ignore? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Ruff supports hierarchical configurations. This allows you to have more specific or diverging configurations per directory. Is this what you're looking for or do you have another use case? |
Beta Was this translation helpful? Give feedback.
-
Thanks, yeah this works! Am I right in the assumption though that one of the two config files are used and that these would not be merged? This is not really important but just curious because with this approach I am duplicating a lot of the configuration. Although I guess this is more explicit than if we had some config here and some config there. |
Beta Was this translation helpful? Give feedback.
Ruff supports hierarchical configurations. This allows you to have more specific or diverging configurations per directory. Is this what you're looking for or do you have another use case?