I want to assign certain ruff rulesets as suggestion/warning rather than hard failures.
Context
I am currently defining the ruff linter on a public open-source project.
In addition to the normal select and ignore of certain rulesets, I would be interested in ruff extending a "suggestion" to the user for certain rulesets. So we can include these into pre-commit hooks and CI pipelines, where these suggestions can inform code reviews and be a learning opportunity, but not block development (or worse, cause devs to commit with the -n flag).
Usecases
Here are two practical examples:
TCH - Typechecking
The ruleset TCH moves imports for type checking into a designated block. This is a nice-to-have but can get in the way of developing a new feature on the package.
TD - TODO comments
The ruleset TD seems generally useful. But consider work on a pull/merge request that requires open issue links with rule TD003. If I were to enforce this ruleset, I would get a slew of issues opened on a PR that is potentially rejected, for the PR to even comply with the enforced ruleset.
In both cases having a warning of "it'd be nice if you'd consider these changes" instead of a hard fail, would be preferred.
Is there any way to do this or a work-around to implement this behaviour?
So far I have tried the following:
I have worked through the documentation and this does not seem to be covered by select or ignore.
I have also considered other Stackoverflow questions, but this is not about excludess per block or file unfortunately.
I want to set this on a configuration-level as I plan to run ruff in a pre-commit hooks (user) and CI/CD pipelines (automation). These different applications would need varying flags individually which can become cumbersone to maintain, when it is behaviour expected on the "ruff-level".
ruff check's--exit-zeroruffchecks inpre-commit. For your "hard" rules configureruffvia saypyproject.toml, and your "soft" rules as a second check configureruffvia command line arguments. don't forgetruff check --isolatedto ignore yourpyproject.tomlin that case.