chore(deps): update dependency ruff to ^0.7.0 #2
Reference in New Issue
Block a user
No description provided.
Delete Branch "renovate/ruff-0.x"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
^0.0.289->^0.7.0Release Notes
astral-sh/ruff (ruff)
v0.7.3Compare Source
Preview features
flake8-pyi] Include all Python file types forPYI006andPYI066(#14059)flake8-simplify] Implementsplit-of-static-string(SIM905) (#14008)refurb] Implementsubclass-builtin(FURB189) (#14105)ruff] Improve diagnostic messages and docs (RUF031,RUF032,RUF034) (#14068)Rule changes
B033,PLC0208) (#14064)eradicate] Better detection of IntelliJ language injection comments (ERA001) (#14094)flake8-pyi] Add autofix fordocstring-in-stub(PYI021) (#14150)flake8-pyi] Updateduplicate-literal-member(PYI062) to alawys provide an autofix (#14188)pyflakes] Detect items that hash to same value in duplicate dictionaries (F601) (#14065)ruff] Fix false positive for decorators (RUF028) (#14061)Bug fixes
# noqa(#12809)eradicate] ignore# language=in commented-out-code rule (ERA001) (#14069)flake8-bugbear] - do not runmutable-argument-defaulton stubs (B006) (#14058)flake8-builtins] Skip lambda expressions inbuiltin-argument-shadowing (A002)(#14144)flake8-comprehension] Also remove trailing comma while fixingC409andC419(#14097)flake8-simplify] Allowopenwithout context manager inreturnstatement (SIM115) (#14066)pylint] Respect hash-equivalent literals initeration-over-set(PLC0208) (#14063)pylint] Update known dunder methods for Python 3.13 (PLW3201) (#14146)pyupgrade] - ignore kwarg unpacking forUP044(#14053)refurb] Parse more exotic decimal strings inverbose-decimal-constructor(FURB157) (#14098)Documentation
v0.7.2Compare Source
Preview features
pyupgrade] Add PEP 646Unpackconversion to*with fix (UP044) (#13988)Rule changes
known_stdlibs.rswith stdlibs 2024.10.25 (#13963)flake8-no-pep420] Skip namespace package enforcement for PEP 723 scripts (INP001) (#13974)Server
Bug fixes
flake8-type-checking] Fix false positive forsingledispatchmethod(TCH003) (#13941)flake8-type-checking] Treat return type ofsingledispatchas runtime-required (TCH003) (#13957)Documentation
flake8-simplify] Include caveats of enablingif-else-block-instead-of-if-exp(SIM108) (#14019)v0.7.1Compare Source
Preview features
E221andE222to flag missing or extra whitespace around==operator (#13890)pylint] Restrictiteration-over-setto only work on sets of literals (PLC0208) (#13731)Rule changes
flake8-type-checking] Support auto-quoting when annotations contain quotes (#11811)Server
Bug fixes
ARG002compatible withEM101when raisingNotImplementedError(#13714)Other changes
v0.7.0Compare Source
Check out the blog post for a migration guide and overview of the changes!
Breaking changes
PT001andPT023now default to omitting the decorator parentheses when there are no arguments(#12838, #13292).
This was a change that we attempted to make in Ruff v0.6.0, but only partially made due to an error on our part.
See the blog post for more details.
useless-try-exceptrule (in ourtryceratopscategory) has been recoded fromTRY302toTRY203(#13502). This ensures Ruff's code is consistent withthe same rule in the
tryceratopslinter.lint.allow-unused-importssetting has been removed (#13677). Uselint.pyflakes.allow-unused-importsinstead.
Formatter preview style
Preview linter features
refurb] implementhardcoded-string-charset(FURB156) (#13530)refurb] Count codepoints not bytes forslice-to-remove-prefix-or-suffix (FURB188)(#13631)Rule changes
pylint] MarkPLE1141fix as unsafe (#13629)flake8-async] Consider async generators to be "checkpoints" forcancel-scope-no-checkpoint(ASYNC100) (#13639)flake8-bugbear] Do not suggest setting parameterstrict=toFalseinB905diagnostic message (#13656)flake8-todos] Only flag the word "TODO", not words starting with "todo" (TD006) (#13640)pycodestyle] Fix whitespace-related false positives and false negatives inside type-parameter lists (E231,E251) (#13704)flake8-simplify] Stabilize preview behavior forSIM115so that the rule can detect filesbeing opened from a wider range of standard-library functions (#12959).
CLI
--statisticscommand (#13774)Bug fixes
pyflakes] Allowipytestcell magic (F401) (#13745)flake8-use-pathlib] FixPTH123false positive whenopenis passed a file descriptor (#13616)flake8-bandit] Detect patterns from multi line SQL statements (S608) (#13574)flake8-pyi] - Fix dropped expressions inPYI030autofix (#13727)v0.6.9Compare Source
Preview features
refurb] MarkFURB118fix as unsafe (#13613)Rule changes
pydocstyle] Don't raiseD208when last line is non-empty (#13372)pylint] Preserve trivia (i.e. comments) inPLR5501autofix (#13573)Configuration
pyflakes] Addallow-unused-importssetting forunused-importrule (F401) (#13601)Bug fixes
flake8-bugbear] Avoid short circuitingB017for multiple context managers (#13609)pylint] Do not offer an invalid fix forPLR1716when the comparisons contain parenthesis (#13527)pyupgrade] FixUP043to apply tocollections.abc.Generatorandcollections.abc.AsyncGenerator(#13611)refurb] Fix handling of slices in tuples forFURB118, e.g.,x[:, 1](#13518)Documentation
astral-sh/ruff-action(#13551)v0.6.8Compare Source
Preview features
match caseclauses (#13510)ifguards inmatch..caseclauses (#13513)ruff analyze graph(#13486)pylint] Implementboolean-chained-comparison(R1716) (#13435)Rule changes
lake8-simplify] DetectSIM910when using variadic keyword arguments, i.e.,**kwargs(#13503)pyupgrade] Avoid false negatives with non-reference shadowed bindings of loop variables (UP028) (#13504)Bug fixes
*args(#13512)Performance
BTreeSetsin module resolver (#13440)v0.6.7Compare Source
Preview features
excludesupport toruff analyze(#13425)Rule changes
pycodestyle] Fix: Don't autofix if the first line ends in a question mark? (D400) (#13399)Bug fixes
lint.excludein ruff check--add-noqa(#13427)Performance
forgetfor module resolver database (#13438)v0.6.6Compare Source
Preview features
refurb] Skipslice-to-remove-prefix-or-suffix(FURB188) when non-trivial slice steps are present (#13405)Formatter
Server
LineIndex::offsetcalculation (#13407)Bug fixes
fastapi] Respect FastAPI aliases in route definitions (#13394)pydocstyle] Respect word boundaries when detecting function signature in docs (#13388)Documentation
FURB188docs (#13406)v0.6.5Compare Source
Preview features
pydoclint] IgnoreDOC201when function name is "new" (#13300)refurb] Implementslice-to-remove-prefix-or-suffix(FURB188) (#13256)Rule changes
eradicate] Ignore script-comments with multiple end-tags (ERA001) (#13283)pyflakes] Improve error message forUndefinedNamewhen a builtin was added in a newer version than specified in Ruff config (F821) (#13293)Server
Bug fixes
ruff] Handle unary operators indecimal-from-float-literal(RUF032) (#13275)CLI
Playground
v0.6.4Compare Source
Preview features
flake8-builtins] Use dynamic builtins list based on Python version (#13172)pydoclint] Permit yieldingNoneinDOC402andDOC403(#13148)pylint] Update diagnostic message forPLW3201(#13194)ruff] Implementpost-init-default(RUF033) (#13192)ruff] Implement useless if-else (RUF034) (#13218)Rule changes
flake8-pyi] Respectpep8_naming.classmethod-decoratorssettings when determining if a method is a classmethod incustom-type-var-return-type(PYI019) (#13162)flake8-pyi] Teach various rules that annotations might be stringized (#12951)pylint] Avoidno-self-useforattrs-style validators (#13166)pylint] Recurse into subscript subexpressions when searching for list/dict lookups (PLR1733,PLR1736) (#13186)pyupgrade] Detectaiofiles.opencalls inUP015(#13173)pyupgrade] Marksys.version_info[0] < 3and similar comparisons as outdated (UP036) (#13175)CLI
ruff formatoutput (#13212)Bug fixes
pydocstyle] Improve heuristics for detecting Google-style docstrings (#13142)refurb] Treatseparguments with effects as unsafe removals (FURB105) (#13165)v0.6.3Compare Source
Preview features
flake8-simplify] Extendopen-file-with-context-handlerto work withdbm.sqlite3(SIM115) (#13104)pycodestyle] DisableE741in stub files (.pyi) (#13119)pydoclint] AvoidDOC201on explicit returns in functions that only returnNone(#13064)Rule changes
flake8-async] Disable check forasynciobefore Python 3.11 (ASYNC109) (#13023)Bug fixes
FastAPI] Avoid introducing invalid syntax in fix forfast-api-non-annotated-dependency(FAST002) (#13133)flake8-implicit-str-concat] Normalize octals before merging concatenated strings insingle-line-implicit-string-concatenation(ISC001) (#13118)flake8-pytest-style] Improve help message forpytest-incorrect-mark-parentheses-style(PT023) (#13092)pylint] Avoid autofix for calls that aren'tminormaxas starred expression (PLW3301) (#13089)ruff] Adddatetime.time,datetime.tzinfo, anddatetime.timezoneas immutable function calls (RUF009) (#13109)ruff] Extend comment deletion forRUF100to include trailing text fromnoqadirectives while preserving any following comments on the same line, if any (#13105)v0.6.2Compare Source
Preview features
flake8-simplify] Extendopen-file-with-context-handlerto work with other standard-library IO modules (SIM115) (#12959)ruff] Avoidunused-asyncfor functions with FastAPI route decorator (RUF029) (#12938)ruff] Ignorefstring-missing-syntax(RUF027) forfastAPIpaths (#12939)ruff] Implement check for Decimal called with a float literal (RUF032) (#12909)Rule changes
flake8-bugbear] Update diagnostic message when expression is at the end of function (B015) (#12944)flake8-pyi] Skip type annotations instring-or-bytes-too-long(PYI053) (#13002)flake8-type-checking] Always recognise relative imports as first-party (#12994)flake8-unused-arguments] Ignore unused arguments on stub functions (ARG001) (#12966)pylint] Ignore augmented assignment forself-cls-assignment(PLW0642) (#12957)Server
Bug fixes
pep8-naming] Don't flagfromimports following conventional import names (N817) (#12946)pylint] - Allow__new__methods to haveclsas their first argument even if decorated with@staticmethodforbad-staticmethod-argument(PLW0211) (#12958)Documentation
hyperfineinstallation instructions; updatehyperfinecode samples (#13034)PT001as per the new default behavior (#13019)perflint] Improve docs fortry-except-in-loop(PERF203) (#12947)pydocstyle] Add reference tolint.pydocstyle.ignore-decoratorssetting to rule docs (#12996)v0.6.1Compare Source
This is a hotfix release to address an issue with
ruff-pre-commit. In v0.6,Ruff changed its behavior to lint and format Jupyter notebooks by default;
however, due to an oversight, these files were still excluded by default if
Ruff was run via pre-commit, leading to inconsistent behavior.
This has now been fixed.
Preview features
fastapi] Implementfast-api-unused-path-parameter(FAST003) (#12638)Rule changes
pylint] Renametoo-many-positionaltotoo-many-positional-arguments(R0917) (#12905)Server
Other changes
flake8-naming]: Respect import conventions (N817) (#12922)v0.6.0Compare Source
Check out the blog post for a migration guide and overview of the changes!
Breaking changes
See also, the "Remapped rules" section which may result in disabled rules.
srclayouts by default forisortrules (#12848)PT001andPT023now default to omitting the decorator parentheses when there are no arguments (#12838).Deprecations
The following rules are now deprecated:
pytest-missing-fixture-name-underscore(PT004)pytest-incorrect-fixture-name-underscore(PT005)unpacked-list-comprehension(UP027)Remapped rules
The following rules have been remapped to new rule codes:
unnecessary-dict-comprehension-for-iterable:RUF025toC420Stabilization
The following rules have been stabilized and are no longer in preview:
singledispatch-method(PLE1519)singledispatchmethod-function(PLE1520)bad-staticmethod-argument(PLW0211)if-stmt-min-max(PLR1730)invalid-bytes-return-type(PLE0308)invalid-hash-return-type(PLE0309)invalid-index-return-type(PLE0305)invalid-length-return-type(PLEE303)self-or-cls-assignment(PLW0642)byte-string-usage(PYI057)duplicate-literal-member(PYI062)redirected-noqa(RUF101)The following behaviors have been stabilized:
cancel-scope-no-checkpoint(ASYNC100): Supportasyncioandanyiocontext mangers.async-function-with-timeout(ASYNC109): Supportasyncioandanyiocontext mangers.async-busy-wait(ASYNC110): Supportasyncioandanyiocontext mangers.async-zero-sleep(ASYNC115): Supportanyiocontext mangers.long-sleep-not-forever(ASYNC116): Supportanyiocontext mangers.The following fixes have been stabilized:
superfluous-else-return(RET505)superfluous-else-raise(RET506)superfluous-else-continue(RET507)superfluous-else-break(RET508)Preview features
flake8-simplify] Further simplify to binary in preview for (SIM108) (#12796)pyupgrade] Show violations without auto-fix (UP031) (#11229)Rule changes
flake8-import-conventions] Addxml.etree.ElementTreeto default conventions (#12455)flake8-pytest-style] Add a space after comma in CSV output (PT006) (#12853)Server
Bug fixes
flake8-async] Do not lint yield in context manager (ASYNC100) (#12896)flake8-comprehensions] Do not lintasync forcomprehensions (C419) (#12895)flake8-return] Only add returnNoneat end of a function (RET503) (#11074)flake8-type-checking] Avoid treatingdataclasses.KW_ONLYas typing-only (TCH003) (#12863)pep8-naming] Treattype(Protocol)et al as metaclass base (N805) (#12770)pydoclint] Don't enforce returns and yields in abstract methods (DOC201,DOC202) (#12771)ruff] Skip tuples with slice expressions in (RUF031) (#12768)ruff] Ignore unparenthesized tuples in subscripts when the subscript is a type annotation or type alias (RUF031) (#12762)ruff] Ignore template strings passed to logging andbuiltins._()calls (RUF027) (#12889)ruff] Do not remove parens for tuples with starred expressions in Python <=3.10 (RUF031) (#12784)Other changes
kernelspecnotebook metadata when detecting the preferred language for a Jupyter Notebook (#12875)v0.5.7Compare Source
Preview features
flake8-comprehensions] Account for list and set comprehensions inunnecessary-literal-within-tuple-call(C409) (#12657)flake8-pyi] Add autofix forfuture-annotations-in-stub(PYI044) (#12676)flake8-return] Avoid syntax error when auto-fixingRET505with mixed indentation (space and tabs) (#12740)pydoclint] Adddocstring-missing-yields(DOC402) anddocstring-extraneous-yields(DOC403) (#12538)pydoclint] AvoidDOC201if docstring begins with "Return", "Returns", "Yield", or "Yields" (#12675)pydoclint] Deduplicate collected exceptions after traversing function bodies (DOC501) (#12642)pydoclint] IgnoreDOCerrors for stub functions (#12651)pydoclint] Teach rules to understand reraised exceptions as being explicitly raised (DOC501,DOC502) (#12639)ruff] Implementincorrectly-parenthesized-tuple-in-subscript(RUF031) (#12480)ruff] MarkRUF023fix as unsafe if__slots__is not a set and the binding is used elsewhere (#12692)Rule changes
refurb] Add autofix forimplicit-cwd(FURB177) (#12708)ruff] Add autofix forzip-instead-of-pairwise(RUF007) (#12663)tryceratops] AddBaseExceptiontoraise-vanilla-classrule (TRY002) (#12620)Server
CLI
pyproject.tomlfiles (#12727)Bug fixes
flake8-async] Fix false positives with multipleasync withitems (ASYNC100) (#12643)flake8-bandit] Avoid false-positives for list concatenations in SQL construction (S608) (#12720)flake8-bugbear] Treatreturnas equivalent tobreak(B909) (#12646)flake8-comprehensions] Set comprehensions not a violation forsuminunnecessary-comprehension-in-call(C419) (#12691)flake8-simplify] Parenthesize conditions based on precedence when merging if arms (SIM114) (#12737)pydoclint] Try both 'Raises' section styles when convention is unspecified (DOC501) (#12649)v0.5.6Compare Source
Ruff 0.5.6 automatically enables linting and formatting of notebooks in preview mode.
You can opt-out of this behavior by adding
*.ipynbto theextend-excludesetting.Preview features
flake8-builtins] Implement import, lambda, and module shadowing (#12546)pydoclint] Adddocstring-missing-returns(DOC201) anddocstring-extraneous-returns(DOC202) (#12485)Rule changes
flake8-return] Exempt cached properties and other property-like decorators from explicit return rule (RET501) (#12563)Server
$/logTracefor server trace logs in Zed and VS Code (#12564)Configuration
flake8-implicit-str-concat] Always allow explicit multi-line concatenations when implicit concatenations are banned (#12532)Bug fixes
flake8-async] Avoid flaggingasyncio.timeouts as unused when the context manager includesasyncio.TaskGroup(#12605)flake8-slots] Avoid recommending__slots__for classes that inherit from more thannamedtuple(#12531)isort] Avoid marking required imports as unused (#12537)isort] Preserve trailing inline comments on import-from statements (#12498)pycodestyle] Add newlines before comments (E305) (#12606)pycodestyle] Don't attach comments with mismatched indents (#12604)pyflakes] Fix preview-mode bugs inF401when attempting to autofix unused first-party submodule imports in an__init__.pyfile (#12569)pylint] Respect start index inunnecessary-list-index-lookup(#12603)pyupgrade] Avoid recommending no-argument super inslots=Truedataclasses (#12530)pyupgrade] Use colon rather than dot formatting for integer-only types (#12534)Other changes
v0.5.5Compare Source
Preview features
fastapi] Implementfastapi-redundant-response-model(FAST001) andfastapi-non-annotated-dependency(FAST002) (#11579)pydoclint] Implementdocstring-missing-exception(DOC501) anddocstring-extraneous-exception(DOC502) (#11471)Rule changes
numpy] Fix NumPy 2.0 rule fornp.alltrueandnp.sometrue(#12473)numpy] IgnoreNPY201insideexceptblocks for compatibility with older numpy versions (#12490)pep8-naming] Avoid applyingignore-namestoselfandclsfunction names (N804,N805) (#12497)Formatter
Server
Bug fixes
Ordimplementation ofcmp_fix(#12471)pydoclint] Fix panic inDOC501reported in #12428 (#12435)flake8-bugbear] Allow singleton tuples with starred expressions inB013(#12484)Documentation
nvim-lspconfig(#12507)v0.5.4Compare Source
Rule changes
ruff] RenameRUF007tozip-instead-of-pairwise(#12399)Bug fixes
flake8-builtins] Avoid shadowing diagnostics for@overridemethods (#12415)flake8-comprehensions] Insert parentheses for multi-argument generators (#12422)pydocstyle] Handle escaped docstrings within docstring (D301) (#12192)Documentation
output-formatdefault in settings reference (#12409)v0.5.3Compare Source
Ruff 0.5.3 marks the stable release of the Ruff language server and introduces revamped
documentation, including setup guides for your editor of
choice and the language server
itself.
Preview features
pyupgrade] Implementunnecessary-default-type-args(UP043) (#12371)Rule changes
flake8-bugbear] Detect enumerate iterations inloop-iterator-mutation(B909) (#12366)flake8-bugbear] Removediscard,remove, andpopallowance forloop-iterator-mutation(B909) (#12365)pylint] Allowrepeated-equality-comparisonfor mixed operations (PLR1714) (#12369)pylint] Ignoreselfandclswhen counting arguments (PLR0913) (#12367)pylint] Use UTF-8 as default encoding inunspecified-encodingfix (PLW1514) (#12370)Server
--previewflag forserversubcommand for the linter and formatter (#12208)Bug fixes
flake8-comprehensions] Allow additional arguments forsumandmaxcomprehensions (C419) (#12364)pylint] Avoid dropping extra boolean operations inrepeated-equality-comparison(PLR1714) (#12368)pylint] Consider expression before statement when determining binding kind (PLR1704) (#12346)Documentation
Other changes
v0.5.2Compare Source
Preview features
spaceseparator before parenthesized expressions in comprehensions with leading comments (#12282)flake8-async] UpdateASYNC100to includeanyioandasyncio(#12221)flake8-async] UpdateASYNC109to includeanyioandasyncio(#12236)flake8-async] UpdateASYNC110to includeanyioandasyncio(#12261)flake8-async] UpdateASYNC115to includeanyioandasyncio(#12262)flake8-async] UpdateASYNC116to includeanyioandasyncio(#12266)Rule changes
flake8-return] Exempt properties from explicit return rule (RET501) (#12243)numpy] Addnp.NAN-to-np.nandiagnostic (#12292)refurb] Makelist-reverse-copyan unsafe fix (#12303)Server
includeandextend-includesettings in native server (#12252)CLI
D203(#12238)Bug fixes
notoperations as boolean tests (#12301)flake8-bandit] AvoidS310violations for HTTP-safe f-strings (#12305)flake8-bandit] Support explicit string concatenations in S310 HTTP detection (#12315)flake8-bandit] fix S113 false positive for httpx withouttimeoutargument (#12213)pycodestyle] Remove "non-obvious" allowance for E721 (#12300)pyflakes] Considerwithblocks as single-item branches for redefinition analysis (#12311)refurb] Restrict forwarding fornewlineargument inopen()calls to Python versions >= 3.10 (#12244)Documentation
--output-format fulldefault (#12248)Performance
v0.5.1Compare Source
Preview features
flake8-bugbear] Implement mutable-contextvar-default (B039) (#12113)pycodestyle] Whitespace after decorator (E204) (#12140)pytest] ReversePT001andPT0023defaults (#12106)Rule changes
flake8-bandit] DetecthttpxforS113(#12174)numpy] UpdateNPY201to include exception deprecations (#12065)pylint] Generate autofix forduplicate-bases(PLE0241) (#12105)Server
Bug fixes
requires-pythoninference robust to==(#12091)str-width (#12135)pycodestyle] AvoidE275if keyword followed by comma (#12136)pycodestyle] AvoidE275if keyword is followed by a semicolon (#12095)pylint] Skip dummy variables forPLR1704(#12190)Performance
parse_identifier(#12103)CompactStringforIdentifierAST node (#12101)v0.5.0Compare Source
Check out the blog post for a migration guide and overview of the changes!
Breaking changes
See also, the "Remapped rules" section which may result in disabled rules.
ALLnow excludes deprecated rules--strip-components=1when untarring./latestURLs on GitHub.flake8-banditrules were modified (#10667).Deprecations
The following rules are now deprecated:
syntax-error(E999): Syntax errors are now always shownRemapped rules
The following rules have been remapped to new rule codes:
blocking-http-call-in-async-function:ASYNC100toASYNC210open-sleep-or-subprocess-in-async-function:ASYNC101split intoASYNC220,ASYNC221,ASYNC230, andASYNC251blocking-os-call-in-async-function:ASYNC102has been merged intoASYNC220andASYNC221trio-timeout-without-await:TRIO100toASYNC100trio-sync-call:TRIO105toASYNC105trio-async-function-with-timeout:TRIO109toASYNC109trio-unneeded-sleep:TRIO110toASYNC110trio-zero-sleep-call:TRIO115toASYNC115repeated-isinstance-calls:PLR1701toSIM101Stabilization
The following rules have been stabilized and are no longer in preview:
mutable-fromkeys-value(RUF024)default-factory-kwarg(RUF026)django-extra(S610)manual-dict-comprehension(PERF403)print-empty-string(FURB105)readlines-in-for(FURB129)if-expr-min-max(FURB136)bit-count(FURB161)redundant-log-base(FURB163)regex-flag-alias(FURB167)isinstance-type-none(FURB168)type-none-comparison(FURB169)implicit-cwd(FURB177)hashlib-digest-hex(FURB181)list-reverse-copy(FURB187)bad-open-mode(PLW1501)empty-comment(PLR2044)global-at-module-level(PLW0604)misplaced-bare-raise(PLE0744)non-ascii-import-name(PLC2403)non-ascii-name(PLC2401)nonlocal-and-global(PLE0115)potential-index-error(PLE0643)redeclared-assigned-name(PLW0128)redefined-argument-from-local(PLR1704)repeated-keyword-argument(PLE1132)super-without-brackets(PLW0245)unnecessary-list-index-lookup(PLR1736)useless-exception-statement(PLW0133)useless-with-lock(PLW2101)The following behaviors have been stabilized:
is-literal(F632) now warns for identity checks against list, set or dictionary literalsneedless-bool(SIM103) now detectsifexpressions with implicitelsebranchesmodule-import-not-at-top-of-file(E402) now allowsos.environmodifications between import statementstype-comparison(E721) now allows idioms such astype(x) is intyoda-condition(SIM300) now flags a wider range of expressionsRemovals
The following deprecated settings have been removed:
output-format=text; useoutput-format=conciseoroutput-format=fulltab-size; useindent-widthThe following deprecated CLI options have been removed:
--show-source; use--output-format=full--no-show-source; use--output-format=conciseThe following deprecated CLI commands have been removed:
ruff <path>; useruff check <path>ruff --clean; useruff cleanruff --generate-shell-completion; useruff generate-shell-completionPreview features
ruff] Addassert-with-print-messagerule (#11981)CLI
--statistics(#11697)fullby default (#12010)Rule changes
ruff] Fix false positives ifgettextis imported using an alias (RUF027) (#12025)numpy] Updatetrapzandin1ddeprecation (NPY201) (#11948)flake8-bandit] Modify diagnostic ranges for shell-related rules (#10667)Server
logFile(#11945)Bug fixes
pycodestyle] AvoidE203for f-string debug expression (#12024)pep8-naming] Match import-name ignores against both name and alias (N812,N817) (#12033)pyflakes] Detect assignments that shadow definitions (F811) (#11961)Parser
Other changes
v0.4.10Compare Source
Parser
Rule changes
flake8-copyright] UpdateCPY001to check the first 4096 bytes instead of 1024 (#11927)pycodestyle] UpdateE999to show all syntax errors instead of just the first one (#11900)Server
Security
v0.4.9Compare Source
Preview features
pylint] Implementconsider-dict-items(C0206) (#11688)refurb] Implementrepeated-global(FURB154) (#11187)Rule changes
pycodestyle] Adapt fix forE203to work identical toruff format(#10999)Formatter
Server
ruff server(#11800)ruff.printDebugInformationcommand (#11831)CLI
Bug fixes
refurb] Avoid suggesting starmap when arguments are used outside call (FURB140) (#11830)flake8-bugbear] Avoid panic inB909when checking large loop blocks (#11772)refurb] Fix misbehavior ofoperator.itemgetterwhen getter param is a tuple (FURB118) (#11774)v0.4.8Compare Source
Performance
Preview features
flake8-bugbear] Implementreturn-in-generator(B901) (#11644)flake8-pyi] ImplementPYI063(#11699)pygrep_hooks] Check blanket ignores via file-level pragmas (PGH004) (#11540)Rule changes
pyupgrade] UpdateUP035for Python 3.13 and the latest version oftyping_extensions(#11693)numpy] UpdateNPY001rule for NumPy 2.0 (#11735)Server
CLI
--output-formatflag (#11682)Bug fixes
pyupgrade] Write empty string in lieu of panic when fixingUP032(#11696)flake8-simplify] Simplify double negatives inSIM103(#11684)typestatements (#11720)v0.4.7Compare Source
Preview features
flake8-pyi] ImplementPYI064(#11325)flake8-pyi] ImplementPYI066(#11541)flake8-pyi] ImplementPYI057(#11486)pyflakes] EnableF822in__init__.pyfiles by default (#11370)Formatter
Server
ruff server(#11590)ruff server(#11615)Bug fixes
flake8-comprehension] Strip parentheses around generators inC400(#11607)repeated-isinstance-callsas unsafe on Python 3.10 and later (#11622)v0.4.6Compare Source
Breaking changes
Preview features
flake8-async] Sleep with >24 hour interval should usually sleep forever (ASYNC116) (#11498)Rule changes
numpy] Add missing functions to NumPy 2.0 migration rule (#11528)mccabe] Consider irrefutable pattern similar toif .. elseforC901(#11565)match-casestatements forC901,PLR0912, andPLR0915(#11521)UP032) (#11524)flake8-bandit]request-without-timeoutshould warn forrequests.request(#11548)flake8-self] Ignore sunder accesses inflake8-selfrules (#11546)pyupgrade] Lint forTypeAliasTypeusages (UP040) (#11530)Server
ruff serverconfiguration discovery (#11551)ruff servercorrectly treats.pyifiles as stub files (#11535)ruff serversearches for configuration in parent directories (#11537)ruff server: An empty code action filter no longer returns notebook source actions (#11526)Bug fixes
flake8-logging-format] Fix autofix title inlogging-warn(G010) (#11514)refurb] Avoid recommendingoperator.itemgetterwith dependence on lambda arguments (#11574)flake8-simplify] Avoid recommending context manager in__enter__implementations (#11575)--output-file(#11550)singledispatcharguments as runtime-required (#11523)v0.4.5Compare Source
Ruff's language server is now in Beta
v0.4.5marks the official Beta release ofruff server, an integrated language server built into Ruff.ruff serversupports the same feature set asruff-lsp, powering linting, formatting, andcode fixes in Ruff's editor integrations -- but with superior performance and
no installation required. We'd love your feedback!
You can enable
ruff serverin the VS Code extension today.To read more about this exciting milestone, check out our blog post!
Rule changes
flake8-future-annotations] Rewordfuture-rewritable-type-annotation(FA100) message (#11381)isort] Expanded the set of standard-library modules to include_string, etc. (#11374)pycodestyle] Consider soft keywords forE27rules (#11446)pyflakes] Recommend adding unused import bindings to__all__(#11314)pyflakes] Update documentation and deprecateignore_init_module_imports(#11436)pyupgrade] Mark quotes as unnecessary for non-evaluated annotations (#11485)Formatter
quote-style = preserve(#11490)Server
noqacomment code actions (#11276)CLI
--output-formatas a CLI option forruff config(#11438)Bug fixes
PLE0237for property with setter (#11377)TCH005forifstmt withelif/elseblock (#11376)__future__annotations as required for non-evaluated type annotations (#11414)flake8-pie] Preserve parentheses inunnecessary-dict-kwargs(#11372)pylint] Ignore__slots__with dynamic values (#11488)pylint] Removetrybody from branch counting (#11487)refurb] Respect operator precedence inFURB110(#11464)Documentation
--previewto the README (#11395)pycodestyle] Clarify motivation forE713andE714(#11483)pyflakes] Update docs to describe WAI behavior (F541) (#11362)pylint] Clearly indicate what is counted as a branch (#11423)v0.4.4Compare Source
Preview features
pycodestyle] Ignore end-of-line comments when determining blank line rules (#11342)pylint] Detectpathlib.Path.opencalls inunspecified-encoding(PLW1514) (#11288)flake8-pyi] ImplementPYI059(generic-not-last-base-class) (#11233)flake8-pyi] ImplementPYI062(duplicate-literal-member) (#11269)Rule changes
flake8-boolean-trap] Allow passing booleans as positional-only arguments in code such asset(True)(#11287)flake8-bugbear] Ignore enum classes incached-instance-method(B019) (#11312)Server
ruff serverhanging after Neovim closes (#11291)Bug fixes
pylint] Considerwithstatements fortoo-many-branches(PLR0912) (#11321)flake8-blind-except,tryceratops] Respect logged and re-raised expressions in nested statements (BLE001,TRY201) (#11301)__all__ = builtins.list(["foo", "bar"])as valid__all__definitions (#11335)v0.4.3Compare Source
Enhancements
Preview features
refurb] Use function range forreimplemented-operatordiagnostics (#11271)refurb] Ignore methods inreimplemented-operator(FURB118) (#11270)refurb] Implementfstring-number-format(FURB116) (#10921)ruff] Implementredirected-noqa(RUF101) (#11052)pyflakes] Distinguish between first-party and third-party imports for fix suggestions (#11168)Rule changes
flake8-bugbear] Ignore non-abstract class attributes when enforcingB024(#11210)flake8-logging] Include inline instantiations when detecting loggers (#11154)pylint] Also emitPLR0206for properties with variadic parameters (#11200)ruff] Detect duplicate codes as part ofunused-noqa(RUF100) (#10850)Formatter
LSP
ruff serversetup guide for Helix (#11183)ruff serverno longer hangs after shutdown (#11222)ruff serverreads from a configuration TOML file in the user configuration directory if no local configuration exists (#11225)ruff serverrespectsper-file-ignoresconfiguration (#11224)ruff server: Support a custom TOML configuration file (#11140)ruff server: Support setting to prioritize project configuration over editor configuration (#11086)Bug fixes
pyflakes] Prioritizeredefined-while-unusedoverunused-import(#11173)ruff] Respectasyncexpressions in comprehension bodies (#11219)pygrep_hooks] Fixblanket-noqapanic when last line has noqa with no newline (PGH004) (#11108)perflint] Ignore list-copy recommendations for asyncforloops (#11250)pyflakes] Improveinvalid-print-syntaxdocumentation (#11171)Performance
Windows
v0.4.2Compare Source
Rule changes
flake8-pyi] Allow for overloaded__exit__and__aexit__definitions (PYI036) (#11057)pyupgrade] Catch usages of"%s" % varand provide an unsafe fix (UP031) (#11019)refurb] Implement new rule that suggests min/max oversorted()(FURB192) (#10868)Server
noqacodes (#11096)Bug fixes
macos-12for building release wheels to enable macOS 11 compatibility (#11146)flake8-blind-expect] Allow raise from inBLE001(#11131)flake8-pyi] Allow simple assignments toNonein enum class scopes (PYI026) (#11128)flake8-simplify] Avoid raisingSIM911for non-zipattribute calls (#11126)refurb] Avoidoperator.itemgettersuggestion for single-item tuple (#11095)ruff] Respect per-file-ignores forRUF100with no other diagnostics (#11058)ruff] Fix async comprehension false positive (RUF029) (#11070)Documentation
flake8-bugbear] Document explicitly disabling strict zip (B905) (#11040)flake8-type-checking] Mentionlint.typing-modulesinTCH001,TCH002, andTCH003(#11144)isort] Improve documentation around customisortsections (#11050)pylint] Fix documentation oversight forinvalid-X-returns(#11094)Performance
matchitto resolve per-file settings (#11111)v0.4.1Compare Source
Parser
Rule changes
flake8-copyright] UpdateCPY001to check the first 4096 bytes instead of 1024 (#11927)pycodestyle] UpdateE999to show all syntax errors instead of just the first one (#11900)Server
Security
v0.4.0Compare Source
A new, hand-written parser
Ruff's new parser is >2x faster, which translates to a 20-40% speedup for all linting and formatting invocations.
There's a lot to say about this exciting change, so check out the blog post for more details!
See #10036 for implementation details.
A new language server in Rust
With this release, we also want to highlight our new language server.
ruff serveris a Rust-powered languageserver that comes built-in with Ruff. It can be used with any editor that supports the Language Server Protocol (LSP).
It uses a multi-threaded, lock-free architecture inspired by
rust-analyzerand it will open the door for a lotof exciting features. It’s also faster than our previous Python-based language server
-- but you probably guessed that already.
ruff serveris only in alpha, but it has a lot of features that you can try out today:ruff.applyAutofix,ruff.applyFormat, andruff.applyOrganizeImportssource.fixAllandsource.organizeImportssource actionsTo setup
ruff serverwith your editor, refer to the README.md.Preview features
pycodestyle] Do not triggerE3rules ondefs following a function/method with a dummy body (#10704)pylint] Implementinvalid-bytes-returned(E0308) (#10959)pylint] Implementinvalid-length-returned(E0303) (#10963)pylint] Implementself-cls-assignment(W0642) (#9267)pylint] Omit stubs frominvalid-boolandinvalid-str-return-type(#11008)ruff] New ruleunused-async(RUF029) to detect unneededasynckeywords on functions (#9966)Rule changes
flake8-bandit] Allowurllib.request.urlopencalls with staticRequestargument (S310) (#10964)flake8-bugbear] Treatraise NotImplemented-only bodies as stub functions (B006) (#10990)flake8-slots] Respect same-fileEnumsubclasses (SLOT000) (#11006)pylint] Support inverted comparisons (PLR1730) (#10920)Linter
--show-settings(#11003)BuiltinTypeChecker(#10976)RuleTable::any_enabled(#10971)Server
This section is devoted to updates for our new language server, written in Rust.
Configuration
RUFF_OUTPUT_FILEenvironment variable support (#10992)Bug fixes
non-augmented-assignmentfor reversed, non-commutative operators (PLR6104) (#10909)PLR6104) (#10912)per-file-ignoresforRUF100on blanket# noqa(#10908)ifexpression for parenthesized with items parsing (#11010)FOR_TARGETcontext for all kinds of parentheses (#11009)v0.3.7Compare Source
Preview features
flake8-bugbear] Implementloop-iterator-mutation(B909) (#9578)pylint] Implement rule to prefer augmented assignment (PLR6104) (#9932)Bug fixes
pylint] Recodenan-comparisonrule toW0177(#10894)pylint] Reverse min-max logic inif-stmt-min-max(#10890)v0.3.6Compare Source
Preview features
pylint] Implementbad-staticmethod-argument(PLW0211) (#10781)pylint] Implementif-stmt-min-max(PLR1730,PLR1731) (#10002)pyupgrade] Replacestr,Enummultiple inheritance withStrEnumUP042(#10713)refurb] Implementif-expr-instead-of-or-operator(FURB110) (#10687)refurb] Implementint-on-sliced-str(FURB166) (#10650)refurb] Implementwrite-whole-file(FURB103) (#10802)refurb] Supportitemgetterinreimplemented-operator(FURB118) (#10526)flake8_comprehensions] Addsum/min/maxto unnecessary comprehension check (C419) (#10759)Rule changes
pydocstyle] Require capitalizing docstrings where the first sentence is a single word (D403) (#10776)pycodestyle] Ignore annotated lambdas in class scopes (E731) (#10720)flake8-pyi] Various improvements to PYI034 (#10807)flake8-slots] Flag subclasses of call-basedtyping.NamedTuples as well as subclasses ofcollections.namedtuple()(SLOT002) (#10808)pyflakes] Allow forward references in class bases in stub files (F821) (#10779)pygrep-hooks] Improveblanket-noqaerror message (PGH004) (#10851)CLI
FORCE_COLORenv var (#10839)Configuration
[extend-]per-file-ignores(#10852)Bug fixes
flake8-import-conventions] Accept non-aliased (but correct) import inunconventional-import-alias(ICN001) (#10729)flake8-quotes] Add semantic model flag when inside f-string replacement field (#10766)pep8-naming] Recursively resolveTypeDictsfor N815 violations (#10719)flake8-quotes] RespectQ00*ignores inflake8-quotesrules (#10728)flake8-simplify] Show negated condition inneedless-booldiagnostics (SIM103) (#10854)ruff] Use within-scope shadowed bindings inasyncio-dangling-task(RUF006) (#10793)flake8-pytest-style] Fix single-tuple conversion inpytest-parametrize-values-wrong-type(PT007) (#10862)flake8-return] Ignore assignments to annotated variables inunnecessary-assign(RET504) (#10741)refurb] Do not allow any keyword arguments forread-whole-fileinrbmode (FURB101) (#10803)pylint] Don't recommend decorating staticmethods with@singledispatch(PLE1519,PLE1520) (#10637)pydocstyle] Use section name range for all section-related docstring diagnostics (#10740)# noqadirectives on__all__openers (#10798)v0.3.5Compare Source
Preview features
pylint] Implementmodified-iterating-set(E4703) (#10473)refurb] Implementfor-loop-set-mutations(FURB142) (#10583)refurb] Implementunnecessary-from-float(FURB164) (#10647)refurb] Implementverbose-decimal-constructor(FURB157) (#10533)Rule changes
flake8-comprehensions] Handled special case forC401which also matchesC416(#10596)flake8-pyi] Markunaliased-collections-abc-set-importfix as "safe" for more cases in stub files (PYI025) (#10547)numpy] Addrow_stackto NumPy 2.0 migration rule (#10646)pycodestyle] Allow cell magics before an import (E402) (#10545)pycodestyle] Avoid blank line rules for the first logical line in cell (#10291)Configuration
flake8-boolean-trap] Add setting for user defined allowed boolean trap (#10531)Bug fixes
__all__definitions when renaming symbols in autofixes (#10527)__all__definitions (#10525)flake8-bugbear] Avoid false positive for usage aftercontinue(B031) (#10539)flake8-copyright] Accept commas in default copyright pattern (#9498)flake8-datetimez] Allow f-strings with%zforDTZ007(#10651)flake8-pytest-style] FixPT014autofix for last item in list (#10532)flake8-quotes] IgnoreQ000,Q001when string is inside forward ref (#10585)isort] Always place non-relative imports after relative imports (#10669)isort] Respect Unicode characters in import sorting (#10529)pyflakes] Fix F821 false negatives whenfrom __future__ import annotationsis active (attempt 2) (#10524)pyflakes] Makeunnecessary-lambdaan always-unsafe fix (#10668)pylint] Fixed false-positive on the rulePLW1641(eq-without-hash) (#10566)ruff] Fix panic in unused# noqaremoval with multi-byte space (RUF100) (#10682)Documentation
CONTRIBUTING.md(#10665)flake8-loggingnext to the other flake8 plugins in registry (#10587)flake8-bandit] Update warning message for ruleS305to address insecure block cipher mode use (#10602)flake8-bugbear] Document use of anonymous assignment inuseless-expression(#10551)flake8-datetimez] Clarify error messages and docs forDTZrules (#10621)pycodestyle] Use same before vs. after numbers forspace-around-operator(#10640)ruff] Changequadratic-list-summationdocs to useiaddconsistently (#10666)v0.3.4Compare Source
Preview features
flake8-simplify] Detect implicitelsecases inneedless-bool(SIM103) (#10414)pylint] Implementnan-comparison(PLW0117) (#10401)pylint] Implementnonlocal-and-global(E115) (#10407)pylint] Implementsingledispatchmethod-function(PLE5120) (#10428)refurb] Implementlist-reverse-copy(FURB187) (#10212)Rule changes
flake8-pytest-style] Add automatic fix forpytest-parametrize-values-wrong-type(PT007) (#10461)pycodestyle] Allow SPDX license headers to exceed the line length (E501) (#10481)Formatter
Bug fixes
C409) (#10491)namefrom being reformatted (#10442)W605(#10480).pyifiles (#10512)E231bug: Inconsistent catch compared to pycodestyle, such as when dict nested in list (#10469)Optionsreferences to blank line docs (#10498)from __future__ import annotationsis active (#10362)"' (#10513)flake8-bugbear] Allow tuples of exceptions (B030) (#10437)flake8-quotes] Avoid syntax errors due to invalid quotes (Q000, Q002) (#10199)v0.3.3Compare Source
Preview features
flake8-bandit]: ImplementS610rule (#10316)pycodestyle] Implementblank-line-at-end-of-file(W391) (#10243)pycodestyle] Implementredundant-backslash(E502) (#10292)pylint] - implementredeclared-assigned-name(W0128) (#9268)Rule changes
flake8_comprehensions] Handled special case forC400which also matchesC416(#10419)flake8-bandit] Implement upstream updates forS311,S324andS605(#10313)pyflakes] RemoveF401fix for__init__imports by default and allow opt-in to unsafe fix (#10365)pylint] Implementinvalid-bool-return-type(E304) (#10377)pylint] Include builtin warnings in useless-exception-statement (PLW0133) (#10394)CLI
ruff check(#8631)Bug fixes
PIE970] Allow trailing ellipsis intyping.TYPE_CHECKING(#10413)TRIO115if the argument is a variable (#10376)F811] Avoid removing shadowed imports that point to different symbols (#10387)F821andF822false positives in.pyifiles (#10341)F821false negatives in.pyfiles whenfrom __future__ import annotationsis active (#10362)Indexerfails to identify continuation preceded by newline #10351 (#10354)Settingsdisplay (#10370)C413] Wrap expressions in parentheses when negating (#10346)pycodestyle] Do not ignore lines before the first logical line in blank lines rules. (#10382)pycodestyle] Do not triggerE225andE275when the next token is a ')' (#10315)pylint] Avoid false-positive slot non-assignment for__dict__(PLE0237) (#10348)Documentation
ruff.tomlformat in README (#10393)RUF008] Make it clearer that a mutable default in a dataclass is only valid if it is typed as a ClassVar (#10395)pylint] Extend docs and test ininvalid-str-return-type(E307) (#10400).fromcheckandformatcommands (#10217)v0.3.2Compare Source
Preview features
withitem formatting for Python 3.8 or older (#10276)Rule changes
pyupgrade] Allow fixes for f-string rule regardless of line length (UP032) (#10263)pycodestyle] Include actual conditions in E712 diagnostics (#10254)Bug fixes
withitems formatting (#10274)Parameterrange for*argsand**kwargs(#10283)typing.Annotatedsubscripts as type definitions (#10285)v0.3.1Compare Source
Preview features
pycodestyle] Fix E301 not triggering on decorated methods. (#10117)pycodestyle] Respectisortsettings in blank line rules (E3*) (#10096)pycodestyle] Make blank lines in typing stub files optional (E3*) (#10098)pylint] Implementsingledispatch-method(E1519) (#10140)pylint] Implementuseless-exception-statement(W0133) (#10176)Rule changes
flake8-debugger] Check for use ofdebugpyandptvsddebug modules (#10177) (#10194)pyupgrade] Generate diagnostic for all valid f-string conversions regardless of line length (UP032) (#10238)pep8_naming] Add fixes forN804andN805(#10215)CLI
ruff format --diff(#10110)--configand--isolatedglobal flags (#10150)--config(#10219)Configuration
required-version(#10216)default-sectionsetting (#10149)Bug fixes
CapWordsmessage (#10220)flake8-raise] Avoid false-positives for parens-on-raise withfuture.exception()(RSE102) (#10206)pylint] Add fix for unary expressions inPLC2801(#9587)ruff] Fix RUF028 not allowing# fmt: skipon match cases (#10178)v0.3.0Compare Source
This release introduces the new Ruff formatter 2024.2 style and adds a new lint rule to
detect invalid formatter suppression comments.
Preview features
flake8-bandit] Remove suspicious-lxml-import (S410) (#10154)pycodestyle] Allowos.environmodifications between imports (E402) (#10066)pycodestyle] Don't warn about a single whitespace character before a comma in a tuple (E203) (#10094)Rule changes
eradicate] Detect commented outcasestatements (ERA001) (#10055)eradicate] Detect single-line code fortry:,except:, etc. (ERA001) (#10057)flake8-boolean-trap] Allow boolean positionals in__post_init__(#10027)flake8-copyright] Allow © in copyright notices (#10065)isort]: Use one blank line after imports in typing stub files (#9971)pylint] New Ruledict-iter-missing-items(PLE1141) (#9845)pylint] Ignoresys.versionandsys.platform(PLR1714) (#10054)pyupgrade] Detect literals with unary operators (UP018) (#10060)ruff] Expand rule forlist(iterable).pop(0)idiom (RUF015) (#10148)Formatter
This release introduces the Ruff 2024.2 style, stabilizing the following changes:
withparentheses when targeting Python 3.9 or newer (#9222)...) in typing stub files (#9155)...) body (#7440, #9240)CLI
extendas part of a--configflag (#10135)buildfrom the default exclusion list (#10093)ruff <path>,ruff --explain,ruff --clean, andruff --generate-shell-completionin favor ofruff check <path>,ruff rule,ruff clean, andruff generate-shell-completion(#10169)--formatfromruff ruleandruff linter(#10170)Bug fixes
flake8-bugbear] Avoid adding default initializers to stubs (B006) (#10152)flake8-type-checking] Respect runtime-required decorators for function signatures (#10091)pycodestyle] Mark fixes overlapping with a multiline string as unsafe (W293) (#10049)pydocstyle] Trim whitespace when removing blank lines after section (D413) (#10162)pylint] Delete entire statement, including semicolons (PLR0203) (#10074)ruff] Avoid f-string false positives ingettextcalls (RUF027) (#10118)ruffcrashing on PowerPC systems because of too small page size (#10080)Performance
Documentation
line-lengthoption: fix link topycodestyle.max-line-length(#10136)v0.2.2Compare Source
Highlights include:
--preview).--configargument (e.g.,--config "lint.isort.combine-as-imports=false").Preview features
pycodestyle] Add blank line(s) rules (E301,E302,E303,E304,E305,E306) (#9266)refurb] Implementreadlines_in_for(FURB129) (#9880)Rule changes
ruff] Ensure closing parentheses for multiline sequences are always on their own line (RUF022,RUF023) (#9793)numpy] Add missing deprecation violations (NPY002) (#9862)flake8-bandit] Detectmark_safeusages in decorators (#9887)ruff] Expandasyncio-dangling-task(RUF006) to includenew_event_loop(#9976)flake8-pyi] Ignore 'unused' private type dicts in class scopes (#9952)Formatter
indent-style=tabs(#9915)preservemode (#9922)CLI
Bug fixes
show-settingsfilters directory-agnostic (#9866)DebugText(#9953)flake8-simplify] Avoid false positive withasyncfor loops (SIM113) (#9996)flake8-trio] Respectasync withintimeout-without-await(#9859)perflint] Catch a wider range of mutations inPERF101(#9955)pycodestyle] FixE30Xpanics on blank lines with trailing white spaces (#9907)pydocstyle] Allow usingparametersas a subsection header (D405) (#9894)pydocstyle] Fix blank-line docstring rules for module-level docstrings (#9878)pylint] Accept 0.0 and 1.0 as common magic values (PLR2004) (#9964)pylint] Avoid suggesting set rewrites for non-hashable types (#9956)ruff] Avoid false negatives with string literals inside of method calls (RUF027) (#9865)ruff] Fix panic on with f-string detection (RUF027) (#9990)ruff] Ignore builtins when detecting missing f-strings (#9849)Performance
memchrfor string lexing (#9888)memchrfor tab-indentation detection (#9853)Result<Tok, LexicalError>size by usingBox<str>instead ofString(#9885)Exprfrom 80 to 64 bytes (#9900)v0.2.1Compare Source
This release includes support for range formatting (i.e., the ability to format specific lines
within a source file).
Preview features
refurb] Implementmissing-f-string-syntax(RUF027) (#9728)Formatter
--rangeoption toruff format(#9733)Bug fixes
__get__and__set__fromunnecessary-dunder-call(#9791)Protocolin ellipsis removal (#9841)Performance
C408(#9822)C400,C401,C410, andC418(#9819)AhoCorasickto speed up quote match (#9773)C405andC409(#9821)zero-sleep-call(#9766)C403(#9818)Documentation
max-pos-argsexample tomax-positional-args(#9797)weak_cryptographic_key.rs(#9774)ANNrules in changelog (#9771)max-positional-args(#9838)v0.2.0Compare Source
Breaking changes
NURSERYselector cannot be used anymoreSee also, the "Remapped rules" section which may result in disabled rules.
Deprecations
The following rules are now deprecated:
missing-type-self(ANN101)missing-type-cls(ANN102)The following command line options are now deprecated:
--show-source; use--output-format fullinstead--no-show-source; use--output-format conciseinstead--output-format text; usefullorconciseinsteadThe following settings have moved and the previous name is deprecated:
ruff.allowed-confusables→ruff.lint.allowed-confusablesruff.dummy-variable-rgx→ruff.lint.dummy-variable-rgxruff.explicit-preview-rules→ruff.lint.explicit-preview-rulesruff.extend-fixable→ruff.lint.extend-fixableruff.extend-ignore→ruff.lint.extend-ignoreruff.extend-per-file-ignores→ruff.lint.extend-per-file-ignoresruff.extend-safe-fixes→ruff.lint.extend-safe-fixesruff.extend-select→ruff.lint.extend-selectruff.extend-unfixable→ruff.lint.extend-unfixableruff.extend-unsafe-fixes→ruff.lint.extend-unsafe-fixesruff.external→ruff.lint.externalruff.fixable→ruff.lint.fixableruff.flake8-annotations→ruff.lint.flake8-annotationsruff.flake8-bandit→ruff.lint.flake8-banditruff.flake8-bugbear→ruff.lint.flake8-bugbearruff.flake8-builtins→ruff.lint.flake8-builtinsruff.flake8-comprehensions→ruff.lint.flake8-comprehensionsruff.flake8-copyright→ruff.lint.flake8-copyrightruff.flake8-errmsg→ruff.lint.flake8-errmsgruff.flake8-gettext→ruff.lint.flake8-gettextruff.flake8-implicit-str-concat→ruff.lint.flake8-implicit-str-concatruff.flake8-import-conventions→ruff.lint.flake8-import-conventionsruff.flake8-pytest-style→ruff.lint.flake8-pytest-styleruff.flake8-quotes→ruff.lint.flake8-quotesruff.flake8-self→ruff.lint.flake8-selfruff.flake8-tidy-imports→ruff.lint.flake8-tidy-importsruff.flake8-type-checking→ruff.lint.flake8-type-checkingruff.flake8-unused-arguments→ruff.lint.flake8-unused-argumentsruff.ignore→ruff.lint.ignoreruff.ignore-init-module-imports→ruff.lint.ignore-init-module-importsruff.isort→ruff.lint.isortruff.logger-objects→ruff.lint.logger-objectsruff.mccabe→ruff.lint.mccaberuff.pep8-naming→ruff.lint.pep8-namingruff.per-file-ignores→ruff.lint.per-file-ignoresruff.pycodestyle→ruff.lint.pycodestyleruff.pydocstyle→ruff.lint.pydocstyleruff.pyflakes→ruff.lint.pyflakesruff.pylint→ruff.lint.pylintruff.pyupgrade→ruff.lint.pyupgraderuff.select→ruff.lint.selectruff.task-tags→ruff.lint.task-tagsruff.typing-modules→ruff.lint.typing-modulesruff.unfixable→ruff.lint.unfixableRemapped rules
The following rules have been remapped to new codes:
raise-without-from-inside-except:TRY200toB904suspicious-eval-usage:PGH001toS307logging-warn:PGH002toG010static-key-dict-comprehension:RUF011toB035runtime-string-union:TCH006toTCH010Stabilizations
The following rules have been stabilized and are no longer in preview:
trio-timeout-without-await(TRIO100)trio-sync-call(TRIO105)trio-async-function-with-timeout(TRIO109)trio-unneeded-sleep(TRIO110)trio-zero-sleep-call(TRIO115)unnecessary-escaped-quote(Q004)enumerate-for-loop(SIM113)zip-dict-keys-and-values(SIM911)timeout-error-alias(UP041)flask-debug-true(S201)tarfile-unsafe-members(S202)ssl-insecure-version(S502)ssl-with-bad-defaults(S503)ssl-with-no-version(S504)weak-cryptographic-key(S505)ssh-no-host-key-verification(S507)django-raw-sql(S611)mako-templates(S702)generator-return-from-iter-method(PYI058)runtime-string-union(TCH006)numpy2-deprecation(NPY201)quadratic-list-summation(RUF017)assignment-in-assert(RUF018)unnecessary-key-check(RUF019)never-union(RUF020)direct-logger-instantiation(LOG001)invalid-get-logger-argument(LOG002)exception-without-exc-info(LOG007)undocumented-warn(LOG009)Fixes for the following rules have been stabilized and are now available without preview:
triple-single-quotes(D300)non-pep604-annotation(UP007)dict-get-with-none-default(SIM910)in-dict-keys(SIM118)collapsible-else-if(PLR5501)if-with-same-arms(SIM114)useless-else-on-loop(PLW0120)unnecessary-literal-union(PYI030)unnecessary-spread(PIE800)error-instead-of-exception(TRY400)redefined-while-unused(F811)duplicate-value(B033)multiple-imports-on-one-line(E401)non-pep585-annotation(UP006)Fixes for the following rules have been promoted from unsafe to safe:
unaliased-collections-abc-set-import(PYI025)The following behaviors have been stabilized:
module-import-not-at-top-of-file(E402) allowssys.pathmodifications between importsreimplemented-container-builtin(PIE807) includes lambdas that can be replaced withdictunnecessary-placeholder(PIE790) applies to unnecessary ellipses (...)if-else-block-instead-of-dict-get(SIM401) applies toif-elseexpressionsPreview features
refurb] Implementmetaclass_abcmeta(FURB180) (#9658)blank_line_after_nested_stub_classpreview style (#9155)and-or-ternary(PLR1706) was removedBug fixes
flake8-async] Takepathlib.Pathinto account when analyzing async functions (#9703)flake8-return] - fix indentation syntax error (RET505) (#9705)RUF022,RUF023: never add two trailing commas to the end of a sequence (#9698)RUF023: Don't sort__match_args__, only__slots__(#9724)flake8-simplify] - Fix syntax error in autofix (SIM114) (#9704)pylint] Show verbatim constant inmagic-value-comparison(PLR2004) (#9694)IfExpwith dual string arms ininvalid-envvar-default(#9734)pylint] Add__mro_entries__to known dunder methods (PLW3201) (#9706)Documentation
v0.1.15Compare Source
Preview features
NURSERYselector is used with--preview(#9682)flake8-return] Add fixes for all rules (RET505,RET506,RET507,RET508) (#9595)flake8-simplify] Add fix forif-with-same-arms(SIM114) (#9591)pycodestyle] Add fix formultiple-imports-on-one-line(E401) (#9518)pylint] Add fix forcollapsible-else-if(PLR5501) (#9594)pylint] Add fix foruseless-else-on-loop(PLW0120) (#9590)pylint] Implementassigning-non-slot(E0237) (#9623)pylint] Implementpotential-index-error(PLE0643) (#9545)pylint] Implementtoo-many-nested-blocks(PLR1702) (#9172)ruff] Add rule to sort__slots__and__match_args__(#9564)ruff] Detect unnecessarydictcomprehensions for iterables (RUF025) (#9613)ruff] Guard against use ofdefault_factoryas a keyword argument (RUF026) (#9651)ruff] Implementmutable-fromkeys-value(RUF024) (#9597)CLI
--helpoutput (#9633)Bug fixes
flake8-no-pep420] Include global--configwhen determining namespace packages (#9603)flake8-pie] Omit bound tuples passed to.startswithor.endswith(#9661)flake8-return] Avoid panic when fixing inlined else blocks (#9657)flake8-return] Consider exception suppression in unnecessary assignment (#9673)flake8-return] TakeNoReturnannotation into account when analyzing implicit returns (#9636)flake8-simplify] Support inverted returns inneedless-bool(SIM103) (#9619)flake8-type-checking] Add Pydantic'sBaseConfigto default-copy list (#9650)flake8-type-checking] Avoid markingInitVaras a typing-only annotation (#9688)pycodestyle] Allowdtypecomparisons intype-comparison(#9676)pydocstyle] Re-implementlast-line-after-section(D413) (#9654)Documentation
flake8-pytest-style] Add fix safety documentation forduplicate-parameterize-test-cases(#9678)pylint] Documentliteral-membershipfix safety conditions (#9677)isort] Fix reference toisortrule code (#9598)v0.1.14Compare Source
Preview features
flake8-bugbear] Add fix forduplicate-value(B033) (#9510)flake8-simplify] Implementenumerate-for-loop(SIM113) (#7777)pygrep_hooks] Add fix fordeprecated-log-warn(PGH002) (#9519)pylint] Implementimport-private-name(C2701) (#5920)refurb] Implementregex-flag-aliaswith fix (FURB167) (#9516)ruff] Add rule and fix to sort contents of__all__(RUF022) (#9474)tryceratops] Add fix forerror-instead-of-exception(TRY400) (#9520)Rule changes
flake8-pyi] FixPYI047false negatives on PEP-695 type aliases (#9566)flake8-pyi] FixPYI049false negatives on call-basedTypedDicts (#9567)pylint] Excludeselfandclswhen counting method arguments (PLR0917) (#9563)CLI
--show-settingsdisplays active settings in a far more readable format (#9464)--extensionsupport to the formatter (#9483)Configuration
pycodestyle] Use the configured tab size when expanding indents (#9506)Bug fixes
flake8-simplify] Avoid some moreenumerate-for-loopfalse positives (SIM113) (#9515)pandas-vet] Limit inplace diagnostics to methods that accept inplace (#9495)pylint] Add the__prepare__method to the list of recognized dunder method (#9529)pylint] Ignore unnecessary dunder calls within dunder definitions (#9496)refurb] Avoid bailing whenreimplemented-operatoris called on function (FURB118) (#9556)ruff] Avoid treating named expressions as static keys (RUF011) (#9494)Documentation
noqawith isort rules (#9555)cargo bench -p ruff_benchmark(#9535)emacs-ruff-format(#9403)flake8-blind-except] Document exceptions toblind-exceptrule (#9580)v0.1.13Compare Source
Bug fixes
flake8-simplify] Account for possibly-empty f-string values in truthiness logic (#9484)pylint] Add the missing period inunnecessary-dunder-call(#9485)pylint] Fix__aenter__message inunnecessary-dunder-call(#9492)v0.1.12Compare Source
Preview features
flake8-bandit] Addssl-with-no-version(S504) (#9384)flake8-bandit] Implementssl-insecure-version(S502) (#9390)flake8-bandit] Implementssl-with-bad-defaults(S503) (#9391)flake8-bandit] Implement suspicious import rules (S4XX) (#8831)flake8-simplify] Implementzip-dict-keys-and-values(SIM911) (#9460)pyflakes] Add a fix forredefined-while-unused(F811) (#9419)pylint] Implementunnecessary-dunder-call(C2801) (#9166)ruff] Addparenthesize-chained-operators(RUF021) to enforce parentheses ina or b and c(#9440)Rule changes
flake8-boolean-trap] Allow Boolean positional arguments in setters (#9429)flake8-builtins] Restrictbuiltin-attribute-shadowing(A003) to actual shadowed references (#9462)flake8-pyi] Add fix forgenerator-return-from-iter-method(PYI058) (#9355)pyflakes] Don't flagredefined-while-unused(F811) inifbranches (#9418)pyupgrade] Add some additional Python 3.12 typing members todeprecated-import(#9445)ruff] Add fix forparenthesize-chained-operators(RUF021) (#9449)ruff] Include subscripts and attributes in static key rule (RUF011) (#9416)ruff] Support variable keys in static dictionary key rule (RUF011) (#9411)Formatter
# fmt: skipwith interspersed same-line comments (#9395)Bug fixes
Nonecomparisons (#9376)DisplayParseErrorfor stdin parser errors (#9409)comment_rangesfor isort directive extraction (#9414)flake8-pyi] Excludewarnings.deprecatedandtyping_extensions.deprecatedarguments (#9423)flake8-pyi] Fix false negative forunused-private-protocol(PYI046) with unused generic protocols (#9405)pydocstyle] Disambiguate argument descriptors from section headers (#9427)pylint] HomogenizePLR0914message to match otherPLR09XXrules (#9399)ruff] AllowHashable = Nonein type annotations (RUF013) (#9442)Documentation
v0.1.11Compare Source
Preview features
pylint] Implementsuper-without-brackets(W0245) (#9257)Bug fixes
python -m ruffinvocations (#9367)Documentation
relative-importsmessage (#9365)yield-in-for-loop(#9364)v0.1.10Compare Source
Preview features
dummy_implementationspreview style formatting (#9240)withstatements (#9222)flake8-pyi] Implementgenerator-return-from-iter-method(PYI058) (#9313)pylint] Implementempty-comment(PLR2044) (#9174)refurb] Implementbit-count(FURB161) (#9265)ruff] Addnever-unionrule to detect redundanttyping.NoReturnandtyping.Never(#9217)CLI
Configuration
Bug fixes
asyncio-dangling-taskfor nonlocal and global bindings (#9263)__str__definitions from super classes (#9338)unused-noqaviaper-file-ignores(#9300)typing_extensionsmembers as typing aliases (#9335)Displayfor formatter parse errors (#9316)flake8-annotations] Avoid adding return types to stub methods (#9277)flake8-annotations] Respect mixedreturnandraisecases in return-type analysis (#9310)flake8-bandit] Don't report violations whenSafeLoaderis imported fromyaml.loader(S506) (#9299)pylint] Avoid panic when comment is preceded by Unicode (#9331)pylint] ChangePLR0917error message to match otherPLR09XXmessages (#9308)refurb] Avoid false positives formath-constant(FURB152) (#9290)Documentation
perflint] DocumentPERF102fix un-safety (#9351)pyupgrade] DocumentUP007fix un-safety (#9306)v0.1.9Compare Source
Breaking changes
Preview features
pylint] Implementtoo-many-locals(PLR0914) (#9163)reimplemented_operator(FURB118) (#9171)no_blank_line_before_class_docstringpreview style (#9154)Rule changes
CONSTANT_CASEvariables are improperly flagged for yoda violation (SIM300) (#9164)flake8-pyi] Cover ParamSpecs and TypeVarTuples (PYI018) (#9198)flake8-bugbear] Add fix forzip-without-explicit-strict(B905) (#9176)printandpprintstatements (T201,T203) (#9208)NevertoNoReturnin auto-typing in Python >= 3.11 (ANN201) (#9213)Formatter
can_omit_optional_parentheses: Exit early for unparenthesized expressions (#9125)dynamicmode with doctests so that it doesn't exceed configured line width (#9129)can_omit_optional_parenthesesfor expressions with a right most fstring (#9124)target_versionto formatter options (#9220)CLI
ruff format --checkto display message for already formatted files (#9153)Bug fixes
operator.contains(#9192)D208with multibyte indent (#9147)NoReturnin auto-return-typing (#9206)typingfromexempt-modules(#9214)mutable-class-defaultviolations for Pydantic subclasses (#9187)PYI055autofix (#9161)asyncio-dangling-taskviolations on shadowed bindings (#9215)Documentation
v0.1.8Compare Source
This release includes opt-in support for formatting Python snippets within
docstrings via the
docstring-code-formatsetting.Check out the blog post for more details!
Preview features
"preserve"quote-style to mimic Black's skip-string-normalization (#8822)prefer_splitting_right_hand_side_of_assignmentspreview style (#8943)pycodestyle] Add fix forunexpected-spaces-around-keyword-parameter-equals(#9072)pycodestyle] Add fix for comment-related whitespace rules (#9075)pycodestyle] Allowsys.pathmodifications between imports (#9047)refurb] Implementhashlib-digest-hex(FURB181) (#9077)Rule changes
flake8-type-checkingrules to automatically quote runtime-evaluated references (#6001)flake8-annotations] AvoidANN2xxfixes for abstract methods with empty bodies (#9034)flake8-self] Ignore underscore references in type annotations (#9036)pep8-naming] Allow class names whenapps.get_modelis a non-string (#9065)pycodestyle] Allowmatplotlib.usecalls to intersperse imports (#9094)pyflakes] Support fixing unused assignments in tuples by renaming variables (F841) (#9107)pylint] Add fix forsubprocess-run-without-check(PLW1510) (#6708)Formatter
docstring-code-formatknob to enable docstring snippet formatting (#8854)CLI
--output-format(#9078)Bug fixes
flake8-err-msg] AllowEMfixes even ifmsgvariable is defined (#9059)flake8-pie] Prevent keyword arguments duplication (#8450)flake8-pie] Respect trailing comma inunnecessary-dict-kwargs(PIE804) (#9015)flake8-raise] Avoid removing parentheses on ctypes.WinError (#9027)isort] Avoid invalid combination offorce-sort-within-typesandlines-between-types(#9041)isort] Ensure that from-style imports are always ordered first in__future__(#9039)pycodestyle] Allow tab indentation before keyword (#9099)pylint] Ignore@overridesand@overloadsfortoo-many-positional(#9000)pyupgrade] Enableprintf-string-formattingfix with comments on right-hand side (#9037)refurb] Makemath-constant(FURB152) rule more targeted (#9054)refurb] Support floating-point base inredundant-log-base(FURB163) (#9100)ruff] Detectunused-asyncio-dangling-task(RUF006) on unused assignments (#9060)v0.1.7Compare Source
Preview features
fix_power_op_line_lengthpreview style (#8947)flake8-annotations] Enable auto-return-type involvingOptionalandUnionannotations (#8885)flake8-bandit] Implementdjango-raw-sql(S611) (#8651)flake8-bandit] Implementtarfile-unsafe-members(S202) (#8829)flake8-pyi] Implement fix forunnecessary-literal-union(PYI030) (#7934)flake8-simplify] Extenddict-get-with-none-default(SIM910) to non-literals (#8762)pylint] - addunnecessary-list-index-lookup(PLR1736) + autofix (#7999)pylint] - implement R0202 and R0203 with autofixes (#8335)pylint] Implementrepeated-keyword(PLe1132) (#8706)pylint] Implementtoo-many-positional(PLR0917) (#8995)pylint] Implementunnecessary-dict-index-lookup(PLR1733) (#8036)refurb] Implementredundant-log-base(FURB163) (#8842)Rule changes
flake8-boolean-trap] Allow booleans in@overridemethods (#8882)flake8-bugbear] AvoidB015,B018for last expression in a cell (#8815)flake8-pie] Allow ellipses for enum values in stub files (#8825)flake8-pyi] Check PEP 695 type aliases forsnake-case-type-aliasandt-suffixed-type-alias(#8966)flake8-pyi] Check for kwarg and varargNoReturntype annotations (#8948)flake8-simplify] Omit select context managers fromSIM117(#8801)pep8-naming] Allow Django model loads innon-lowercase-variable-in-function(N806) (#8917)pycodestyle] AvoidE703for last expression in a cell (#8821)pycodestyle] UpdateE402to work at cell level for notebooks (#8872)pydocstyle] AvoidD100for Jupyter Notebooks (#8816)pylint] Implement fix forunspecified-encoding(PLW1514) (#8928)Formatter
CLI
ruff checkandruff formatto default to the current directory (#8791)Configuration
pylint] Defaultmax-positional-argstomax-args(#8998)pylint] Addallow-dunder-method-namessetting forbad-dunder-method-name(PLW3201) (#8812)isort] Add support forfrom-firstsetting (#8663)isort] Add support forlength-sortsettings (#8841)Bug fixes
@functools.singledispatch(#8934)get_modelmatching (#8965)@overloadand@overridemethods for too-many-arguments checks (#8954)Mode::Expression(#8880)pydantic_settings.BaseSettingsas having default copy semantics (#8793)NamedTupleassignments (#8810)flake8-type-checking(#8768)flake8-annotations] Avoid filtering out un-representable types in return annotation (#8881)flake8-pie] Retain extra ellipses in protocols and abstract methods (#8769)flake8-pyi] Respect local enum subclasses insimple-defaults(PYI052) (#8767)flake8-trio] Use correct range forTRIO115fix (#8933)flake8-trio] Use full arguments range for zero-sleep-call (#8936)isort] fix: mark__main__as first-party import (#8805)pep8-naming] AvoidN806errors for type alias statements (#8785)perflint] AvoidPERF101if there's an append in loop body (#8809)pycodestyle] Allow space-before-colon after end-of-slice (#8838)pydocstyle] Avoid non-character breaks inover-indentation(D208) (#8866)pydocstyle] Ignore underlines when determining docstring logical lines (#8929)pylint] Extendself-assigning-variableto multi-target assignments (#8839)tryceratops] Avoid repeated triggers in nestedtryceratopsdiagnostics (#8772)Documentation
flake8-pyi] Fix error int-suffixed-type-alias(PYI043) example (#8963)flake8-pyi] Improve motivation forcustom-type-var-return-type(PYI019) (#8766)v0.1.6Compare Source
Preview features
flake8-boolean-trap] Extendboolean-type-hint-positional-argument(FBT001) to include booleans in unions (#7501)flake8-pie] Extendreimplemented-list-builtin(PIE807) todictreimplementations (#8608)flake8-pie] Extendunnecessary-pass(PIE790) to include ellipses (...) (#8641)flake8-pie] Implement fix forunnecessary-spread(PIE800) (#8668)flake8-quotes] Implementunnecessary-escaped-quote(Q004) (#8630)pycodestyle] Implement fix formultiple-spaces-after-keyword(E271) andmultiple-spaces-before-keyword(E272) (#8622)pycodestyle] Implement fix formultiple-spaces-after-operator(E222) andmultiple-spaces-before-operator(E221) (#8623)pyflakes] Extendis-literal(F632) to include comparisons against mutable initializers (#8607)pylint] Implementredefined-argument-from-local(PLR1704) (#8159)pylint] Implement fix forunnecessary-lambda(PLW0108) (#8621)refurb] Implementif-expr-min-max(FURB136) (#8664)refurb] Implementmath-constant(FURB152) (#8727)Rule changes
flake8-annotations] Add autotyping-like return type inference for annotation rules (#8643)flake8-future-annotations] Implement fix forfuture-required-type-annotation(FA102) (#8711)flake8-implicit-namespace-package] Avoid missing namespace violations in scripts with shebangs (#8710)pydocstyle] Updateover-indentation(D208) to preserve indentation offsets when fixing overindented lines (#8699)pyupgrade] Refinetimeout-error-alias(UP041) to remove false positives (#8587)Formatter
awaitformatting with fluent style (#8676)CLI
Configuration
isort] Support disabling sections withno-sections = true(#8657)pep8-naming] Support local and dynamic class- and static-method decorators (#8592)pydocstyle] Allow overriding pydocstyle convention rules (#8586)Bug fixes
trio.lowlevel(#8730)PIE794(#8634)EMfixes (#7746)whitespace-before-punctuation(E203) (#8654)no-self-use(#8637)PLW0129(#8675)TYPE_CHECKINGblocks imported fromtyping_extensionsor_typeshed(#8429)FURB113autofix if comments are present (#8494)flake8-commas(#8582)force-sort-within-sections(#8665)Documentation
v0.1.5Compare Source
Preview features
flake8-bandit] Implementmako-templates(S702) (#8533)flake8-trio] ImplementTRIO105(#8490)flake8-trio] ImplementTRIO109(#8534)flake8-trio] ImplementTRIO110(#8537)flake8-trio] ImplementTRIO115(#8486)refurb] Implementtype-none-comparison(FURB169) (#8487)E721(#8491)SIM118fix as safe when the expression is a known dictionary (#8525)Formatter
CLI
--extensionto override inference of source type from file extension (#8373)Configuration
extend_unsafe_fixesandoverride extend_safe_fixes(#8444)RUFF_NO_CACHEenvironment variable (#8538)Bug fixes
E721] Flag comparisons tomemoryview(#8485)D301autofix foruprefixed strings (#8495)flake8-triorules whentrioimport is present (#8550)TRIO115violations fortrio.sleep(...)calls with non-number values (#8532)F841false negative on assignment to multiple variables (#8489)Documentation
known-first-party(#8562)project.requires-pythonovertarget-version(#8513)B008documentation (#8501)v0.1.4Compare Source
Preview features
flake8-trio] Implementtimeout-without-await(TRIO001) (#8439)numpy] Implement NumPy 2.0 migration rule (NPY200) (#7702)pylint] Implementbad-open-mode(W1501) (#8294)pylint] Implementimport-outside-toplevel(C0415) rule (#5180)pylint] Implementuseless-with-lock(W2101) (#8321)pyupgrade] Implementtimeout-error-alias(UP041) (#8476)refurb] Implementisinstance-type-none(FURB168) (#8308)RUF001,RUF002, andRUF003(#4430)Formatter
fmt: skip(#8273)fmt: off(#8275)--line-lengthoption toformatcommand (#8363)CLI
--output-formattoruff ruleandruff linter(#8203)Bug fixes
--force-excludeinlint.excludeandformat.exclude(#8393)--extend-per-file-ignoreson the CLI (#8329)bad-dunder-method-nameto permit__index__(#8300)D300when both triple quote styles are present (#8462)FStringRanges(#8154)shell=Truefor truthy, non-Truediagnostics (#8359)NamedTuplerewrite with starred annotation (#8434)PLE1307was raised when formatting%cwith characters (#8407)fixedOverflowWidgetsfor playground popover (#8458)byte_boundsas a non-backwards-compatible NumPy 2.0 change (#8474)Internals
--fixand--diff(#8316)v0.1.3Compare Source
This release includes a variety of improvements to the Ruff formatter, removing several known and
unintentional deviations from Black.
Formatter
None,TrueandFalse(#8189)isortsettings (#8192)isort.force-single-lineis true (#8244)SourceKind::difffor formatter (#8240)fmt:offwith trailing child comment (#8234)IpyEscapeCommand(#8207)Linter
pylint] Add buffer methods tobad-dunder-method-name(PLW3201) exclusions (#8190)externalcodes setting inunused-noqa(#8177)line-lengthsetting for isort in lieu ofpycodestyle.max-line-length(#8235)unnecessary-paren-on-raise-exceptionto unsafe for unknown types (#8231)W605(#8255)Documentation
unused-noqa(#8172)externaloption tounused-noqadocumentation (#8171)magic-trailing-commaoption in README (#8200)v0.1.2Compare Source
This release includes the Beta version of the Ruff formatter — an extremely fast, Black-compatible Python formatter.
Try it today with
ruff format! Check out the blog post and read the docs.Preview features
pylint] Implementnon-ascii-module-import(C2403) (#8056)pylint] implementnon-ascii-name(C2401) (#8038)pylint] Implement unnecessary-lambda (W0108) (#7953)refurb] Implementread-whole-file(FURB101) (#7682)E223,E224, andE242(#8143)E225,E226,E227, andE228(#8136)E252(#8142)E261(#8114)E273andE274(#8144)E275(#8133)SIM401to catch ternary operations (#7415)E721to allowisandisnot for direct type comparisons (#7905)Rule changes
backports.strenumtodeprecated-imports(#8113)SIM112to ignorehttps_proxy,http_proxy, andno_proxy(#8140)literal-membership(PLR6201) to be unsafe (#8097)mutable-argument-defaults(B006) to be unsafe (#8108)Formatter
line-endingdefault toauto(#8057)has_own_parentheses(#8100)--line-lengthoption fromformatcommand (#8131)line-lengthdocumentation (#8150)CLI
ruff formatcommand in help menus (#8167)ruff versioncommand with long version display (#8034)Configuration
pycodestyle.max-line-lengthoption (#8039)Bug fixes
sys.version_infoslices inoutdated-version-block(#8112)TYPE_CHECKINGblocks (#8072)Documentation
too-many-argumentslint (#8092)extend-unsafe-fixesandextend-safe-fixesexample (#8139)flake8-import-conventionsoptions (#8115)OptionsJSON schema description (#8081)pytext->pytest) (#8117)magic-value-comparisonexample in docs (#8111)v0.1.1Compare Source
Preview features
NURSERYselector is used with--preview(#9682)flake8-return] Add fixes for all rules (RET505,RET506,RET507,RET508) (#9595)flake8-simplify] Add fix forif-with-same-arms(SIM114) (#9591)pycodestyle] Add fix formultiple-imports-on-one-line(E401) (#9518)pylint] Add fix forcollapsible-else-if(PLR5501) (#9594)pylint] Add fix foruseless-else-on-loop(PLW0120) (#9590)pylint] Implementassigning-non-slot(E0237) (#9623)pylint] Implementpotential-index-error(PLE0643) (#9545)pylint] Implementtoo-many-nested-blocks(PLR1702) (#9172)ruff] Add rule to sort__slots__and__match_args__(#9564)ruff] Detect unnecessarydictcomprehensions for iterables (RUF025) (#9613)ruff] Guard against use ofdefault_factoryas a keyword argument (RUF026) (#9651)ruff] Implementmutable-fromkeys-value(RUF024) (#9597)CLI
--helpoutput (#9633)Bug fixes
flake8-no-pep420] Include global--configwhen determining namespace packages (#9603)flake8-pie] Omit bound tuples passed to.startswithor.endswith(#9661)flake8-return] Avoid panic when fixing inlined else blocks (#9657)flake8-return] Consider exception suppression in unnecessary assignment (#9673)flake8-return] TakeNoReturnannotation into account when analyzing implicit returns (#9636)flake8-simplify] Support inverted returns inneedless-bool(SIM103) (#9619)flake8-type-checking] Add Pydantic'sBaseConfigto default-copy list (#9650)flake8-type-checking] Avoid markingInitVaras a typing-only annotation (#9688)pycodestyle] Allowdtypecomparisons intype-comparison(#9676)pydocstyle] Re-implementlast-line-after-section(D413) (#9654)Documentation
flake8-pytest-style] Add fix safety documentation forduplicate-parameterize-test-cases(#9678)pylint] Documentliteral-membershipfix safety conditions (#9677)isort] Fix reference toisortrule code (#9598)v0.1.0Compare Source
This is the first release which uses the
CHANGELOGfile. See GitHub Releases for prior changelog entries.Read Ruff's new versioning policy.
Breaking changes
formatsetting has been removed (#7984)formatsetting cannot be used to configure the output format, useoutput-formatinsteadRUFF_FORMATenvironment variable is ignored, useRUFF_OUTPUT_FORMATinstead--formatoption has been removed fromruff check, use--output-formatinsteadRule changes
reimplemented-starmap(FURB140) to catch calls with a single and starred argument (#7768)RUF015(#7848)SIM15to allowopenfollowed byclose(#7916)msgspec.Structdefault-copy semantics inRUF012(#7786)sqlalchemymethods to `flake8-boolean-trap`` exclusion list (#7874)PLR1714(#7910)PIE804(#7884)PLC0208(#7887)PYI055(#7886)non-pep695-type-aliasto require--unsafe-fixesoutside of stub files (#7836)UP018(#7913)PLW3201to supportEnumsunder names (#7987)Preview features
unnecessary-key-checkto simplifykey in dct and dct[key]todct.get(key)(#7895)assignment-in-assertto prevent walrus expressions in assert statements (#7856)refurb] Addsingle-item-membership-test(FURB171) (#7815)pylint] Addand-or-ternary(R1706) (#7811)New rules are added in preview.
Configuration
unsafe-fixessetting (#7769)extend-safe-fixesandextend-unsafe-fixesfor promoting and demoting fixes (#7841)CLI
--unsafe-fixesoption for opt-in to display and apply unsafe fixes (#7769)--formatoption in warning (#7837)--check(#7788)check --diffto include unsafe fix hints (#7790)cellfield to JSON output format (#7664)Safe,Unsafe, andDisplay(#7843)Bug fixes
SIM110with a yield in the condition (#7801)C414fixes (#7775)unnecessary-enumeratelensuggestion (#7781)SIM101(#7798)E251false positive inside f-strings (#7894)stdin(#7789)ruff rule(#7812)--unfixableinISCrules (#7917)PIE804(#7922)PTH118forPath.joinpathwith starred arguments (#7852)outdated-version-blockwhen using greater than comparisons (#7920)gettextcalls (#7898)PLR6301(#7933)TCH004(#7968)cache-dirrelative to project root (#7962)TCH003(#7954)line-length(#7883)coalescekeyword (#7876)Documentation
reimplemented-starmapperformance effects (#7846)PLR6301(#7831)UP038docs to note that it results in slower code (#7872)unnecessary-subscript-reversal(#7774)FURB177example (#7832)Formatter
ruff formatmessage (#7867)ruff_python_formattergenerate.py comment (#7850)Playground
Quick Fixaction (#7824)v0.0.292Compare Source
What's Changed
Highlights
This release includes full support for Python 3.12 (out now!), including the new type parameter (PEP 695) and f-string syntaxes (PEP 701).
PEP 701 lifts many of the restrictions on f-strings that existed in the past, allowing for arbitrarily nested f-strings, consistent quote style within f-strings, and more, all of which are now supported by Ruff (thanks to @dhruvmanila in https://github.com/astral-sh/ruff/pull/7376).
Breaking Changes
format.quote-styleno longer affects triple-quoted strings, to align with common conventions as well as the guidance from PEP 8 and PEP 257 (see: https://github.com/astral-sh/ruff/pull/7680).line-too-long(E501) now ignores trailing pragma comments (like# type: ignoreand# noqa) when computing line length (see: https://github.com/astral-sh/ruff/pull/7692). This is similar to flake8-bugbear's methodology for detecting overlong lines, and ensures that adding pragmas like# noqadoes not introduce further lint errors.Rules
refurb] Implementprint-empty-string(FURB105) by @tjkuson in https://github.com/astral-sh/ruff/pull/7617flake8-bandit] Implementweak-cryptographic-key(S505) by @mkniewallner in https://github.com/astral-sh/ruff/pull/7703refurb] Implementimplicit-cwd(FURB177) by @danparizher in https://github.com/astral-sh/ruff/pull/7704unnecessary-pass(PIE790) now flags all unnecessarypassstatements; previously, the rule only flaggedpassstatements that followed a docstring in a two-statement body (see: https://github.com/astral-sh/ruff/pull/7697).Settings
lintsection to Ruff configuration by @MichaReiser in https://github.com/astral-sh/ruff/pull/7549explicit-preview-rulesto toggle explicit selection of preview rules by @zanieb in https://github.com/astral-sh/ruff/pull/7390stdoutby @charliermarsh in https://github.com/astral-sh/ruff/pull/7748unnecessary-pass(PIE790) to trigger on all unnecessarypassstatements by @tjkuson in https://github.com/astral-sh/ruff/pull/7697Bug Fixes
PT022autofix by @dhruvmanila in https://github.com/astral-sh/ruff/pull/7613builtin.open()withPath.open()if the latter doesn't support all options by @konstin in https://github.com/astral-sh/ruff/pull/7637Expr::Namechecks to rules which useis_logger_candidateby @qdegraaf in https://github.com/astral-sh/ruff/pull/7521__all__assignments by @charliermarsh in https://github.com/astral-sh/ruff/pull/7673commented-out-codeby @tjkuson in https://github.com/astral-sh/ruff/pull/7523unnecessary-passby @charliermarsh in https://github.com/astral-sh/ruff/pull/7715quadratic-list-summationby @charliermarsh in https://github.com/astral-sh/ruff/pull/7719NotebookIndexforDiagnosticson stdin by @dhruvmanila in https://github.com/astral-sh/ruff/pull/7663LexErrorfor dedent to incorrect level by @MichaReiser in https://github.com/astral-sh/ruff/pull/7638DeprecatedLogWarnto check forExpr::Atrributecalls by @qdegraaf in https://github.com/astral-sh/ruff/pull/7677Other Changes
commented-out-code(~50-80%) by @charliermarsh in https://github.com/astral-sh/ruff/pull/7706New Contributors
Full Changelog: https://github.com/astral-sh/ruff/compare/v0.0.291...v0.0.292
v0.0.291Compare Source
What's Changed
Deprecations
The
formatcommand-line argument and configuration option has been renamed tooutput-format. While Ruff will continue to respectformatwhen passed as a command-line argument or configuration option, this backwards-compatible support will be dropped in a future release. See: https://github.com/astral-sh/ruff/pull/7514.Rules
flake8-bandit] ImplementS201:flask-debug-trueby @mkniewallner in https://github.com/astral-sh/ruff/pull/7503flake8-bandit] ImplementS507:ssh_no_host_key_verificationby @mkniewallner in https://github.com/astral-sh/ruff/pull/7528flake8-logging] ImplementLOG002:invalid-get-logger-argumentby @dhruvmanila in https://github.com/astral-sh/ruff/pull/7399flake8-logging] ImplementLOG007:exception-without-exc-infoby @qdegraaf in https://github.com/astral-sh/ruff/pull/7410refurb] ImplementFURB140:reimplemented-starmapby @SavchenkoValeriy in https://github.com/astral-sh/ruff/pull/7253refurb] ImplementFURB148:unnecessary-enumerateby @tjkuson in https://github.com/astral-sh/ruff/pull/7454ruff] Detectasyncio.get_running_loopcalls in RUF006 by @charliermarsh in https://github.com/astral-sh/ruff/pull/7562Settings
--no-Xvariants in CLI help by @charliermarsh in https://github.com/astral-sh/ruff/pull/7504formatoption tooutput-formatby @MichaReiser in https://github.com/astral-sh/ruff/pull/7514ruff ruleby @charliermarsh in https://github.com/astral-sh/ruff/pull/7560Bug Fixes
bad-dunder-method-nameto permitattrsdunders by @tjkuson in https://github.com/astral-sh/ruff/pull/7472.exception()calls by @charliermarsh in https://github.com/astral-sh/ruff/pull/7524PERF102fixes by @charliermarsh in https://github.com/astral-sh/ruff/pull/7554os.erroras anOSErroralias by @charliermarsh in https://github.com/astral-sh/ruff/pull/7582bad-dunder-method-nameto permit__html__by @jaap3 in https://github.com/astral-sh/ruff/pull/7492New Contributors
Full Changelog: https://github.com/astral-sh/ruff/compare/v0.0.290...v0.0.291
v0.0.290Compare Source
What's Changed
Rules
deprecated-importlists based on recenttyping-extensionsrelease by @charliermarsh in https://github.com/astral-sh/ruff/pull/7356UP040by @nathanwhit in https://github.com/astral-sh/ruff/pull/6749Settings
Bug Fixes
C416to catch tuple unpacking by @charliermarsh in https://github.com/astral-sh/ruff/pull/7363NURSERYrule selctor in JSON Schema by @charliermarsh in https://github.com/astral-sh/ruff/pull/7374D411by @charliermarsh in https://github.com/astral-sh/ruff/pull/7351Preview
What's this section?
flake8-logging] New ruleundocumented-warn(LOG009) by @qdegraaf in https://github.com/astral-sh/ruff/pull/7249flake8-logging] New ruledirect-logger-instantiation(LOG001) by @charliermarsh in https://github.com/astral-sh/ruff/pull/7397flake8-logging] New pluginflake8_logging(LOG) by @qdegraaf in https://github.com/astral-sh/ruff/pull/7249perflint] Addmanual-dict-comprehsion(PERF403) by @qdegraaf in https://github.com/astral-sh/ruff/pull/6132pylint] New ruletoo-many-public-methods(PLR0904) by @jelly in https://github.com/astral-sh/ruff/pull/6179refurb] New ruleno-slice-copy(FURB145) by @tjkuson in https://github.com/astral-sh/ruff/pull/7007PREVIEWrule selector by @zanieb in https://github.com/astral-sh/ruff/pull/7389pre-commitsupport for the alpha formatter by @zanieb in https://github.com/astral-sh/ruff-pre-commit/pull/50New Contributors
Full Changelog: https://github.com/astral-sh/ruff/compare/v0.0.289...v0.0.290
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.