misplaced-comparison-constant
(PLC2201
) was deprecated in favor of SIM300
(#1980)
These two rules contain (nearly) identical logic. To deduplicate the rule set, we've upgraded
SIM300
to handle a few more cases, and deprecated PLC2201
in favor of SIM300
.
@functools.cache
rewrites have been moved to a standalone rule (UP033
) (#1938)
Previously, UP011
handled both @functools.lru_cache()
-to-@functools.lru_cache
conversions,
and @functools.lru_cache(maxsize=None)
-to-@functools.cache
conversions. The latter has been
moved out to its own rule (UP033
). As such, some # noqa: UP011
comments may need to be updated
to reflect the change in rule code.
--max-complexity
has been removed from the CLI (#1877)
The McCabe plugin's --max-complexity
setting has been removed from the CLI, for consistency with
the treatment of other, similar settings.
To set the maximum complexity, use the max-complexity
property in your pyproject.toml
file,
like so:
[tool.ruff.mccabe]
max-complexity = 10
Files excluded by .gitignore
are now ignored (#1234)
Ruff will now avoid checking files that are excluded by .ignore
, .gitignore
,
.git/info/exclude
, and global gitignore
files. This behavior is powered by the ignore
crate, and is applied in addition to Ruff's built-in exclude
system.
To disable this behavior, set respect-gitignore = false
in your pyproject.toml
file.
Note that hidden files (i.e., files and directories prefixed with a .
) are not ignored by
default.
Configuration files are now resolved hierarchically (#1190)
pyproject.toml
files are now resolved hierarchically, such that for each Python file, we find
the first pyproject.toml
file in its path, and use that to determine its lint settings.
See the README for more.