0.5.0
版本发布时间: 2024-06-27 23:42:40
astral-sh/ruff最新发布版本:0.5.3(2024-07-19 01:10:02)
Release Notes
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.
- Follow the XDG specification to discover user-level configurations on macOS (same as on other Unix platforms)
- Selecting
ALL
now excludes deprecated rules - The released archives now include an extra level of nesting, which can be removed with
--strip-components=1
when untarring. - The release artifact's file name no longer includes the version tag. This enables users to install via
/latest
URLs on GitHub. - The diagnostic ranges for some
flake8-bandit
rules were modified (#10667).
Deprecations
The following rules are now deprecated:
-
syntax-error
(E999
): Syntax errors are now always shown
Remapped rules
The following rules have been remapped to new rule codes:
-
blocking-http-call-in-async-function
:ASYNC100
toASYNC210
-
open-sleep-or-subprocess-in-async-function
:ASYNC101
split intoASYNC220
,ASYNC221
,ASYNC230
, andASYNC251
-
blocking-os-call-in-async-function
:ASYNC102
has been merged intoASYNC220
andASYNC221
-
trio-timeout-without-await
:TRIO100
toASYNC100
-
trio-sync-call
:TRIO105
toASYNC105
-
trio-async-function-with-timeout
:TRIO109
toASYNC109
-
trio-unneeded-sleep
:TRIO110
toASYNC110
-
trio-zero-sleep-call
:TRIO115
toASYNC115
-
repeated-isinstance-calls
:PLR1701
toSIM101
Stabilization
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 literals -
needless-bool
(SIM103
) now detectsif
expressions with implicitelse
branches -
module-import-not-at-top-of-file
(E402
) now allowsos.environ
modifications between import statements -
type-comparison
(E721
) now allows idioms such astype(x) is int
-
yoda-condition
(SIM300
) now flags a wider range of expressions
Removals
The following deprecated settings have been removed:
-
output-format=text
; useoutput-format=concise
oroutput-format=full
-
tab-size
; useindent-width
The following deprecated CLI options have been removed:
-
--show-source
; use--output-format=full
-
--no-show-source
; use--output-format=concise
The following deprecated CLI commands have been removed:
-
ruff <path>
; useruff check <path>
-
ruff --clean
; useruff clean
-
ruff --generate-shell-completion
; useruff generate-shell-completion
Preview features
- [
ruff
] Addassert-with-print-message
rule (#11981)
CLI
- Use rule name rather than message in
--statistics
(#11697) - Use the output format
full
by default (#12010) - Don't log syntax errors to the console (#11902)
Rule changes
- [
ruff
] Fix false positives ifgettext
is imported using an alias (RUF027
) (#12025) - [
numpy
] Updatetrapz
andin1d
deprecation (NPY201
) (#11948) - [
flake8-bandit
] Modify diagnostic ranges for shell-related rules (#10667)
Server
- Closing an untitled, unsaved notebook document no longer throws an error (#11942)
- Support the usage of tildes and environment variables in
logFile
(#11945) - Add option to configure whether to show syntax errors (#12059)
Bug fixes
- [
pycodestyle
] AvoidE203
for 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
- Emit a syntax error for an empty type parameter list (#12030)
- Avoid consuming the newline for unterminated strings (#12067)
- Do not include the newline in the unterminated string range (#12017)
- Use the correct range to highlight line continuation errors (#12016)
- Consider 2-character EOL before line continuations (#12035)
- Consider line continuation character for re-lexing (#12008)
Other changes
- Upgrade the Unicode table used for measuring the line-length (#11194)
- Remove the deprecation error message for the nursery selector (#10172)
Contributors
- @AlexWaygood
- @MichaReiser
- @Peiffap
- @R1kaB3rN
- @baggiponte
- @charliermarsh
- @dedebenui
- @denwong47
- @dhruvmanila
- @ericbn
- @relausen
- @renovate
- @snowsignal
- @ukyen8
- @wyardley
- @tibor-reiss
- @T-256
- @WindowGenerator
- @augustelalande
Install ruff 0.5.0
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/ruff/releases/download/0.5.0/ruff-installer.sh | sh
Install prebuilt binaries via powershell script
powershell -c "irm https://github.com/astral-sh/ruff/releases/download/0.5.0/ruff-installer.ps1 | iex"
Download ruff 0.5.0
1、 dist-manifest.json 45.48KB
2、 ruff-aarch64-apple-darwin.tar.gz 7.72MB
3、 ruff-aarch64-apple-darwin.tar.gz.sha256 99B
4、 ruff-aarch64-pc-windows-msvc.zip 7.36MB
5、 ruff-aarch64-pc-windows-msvc.zip.sha256 99B
6、 ruff-aarch64-unknown-linux-gnu.tar.gz 9.43MB
7、 ruff-aarch64-unknown-linux-gnu.tar.gz.sha256 104B
8、 ruff-aarch64-unknown-linux-musl.tar.gz 9.42MB
9、 ruff-aarch64-unknown-linux-musl.tar.gz.sha256 105B
10、 ruff-arm-unknown-linux-musleabihf.tar.gz 8.99MB
11、 ruff-arm-unknown-linux-musleabihf.tar.gz.sha256 107B
12、 ruff-armv7-unknown-linux-gnueabihf.tar.gz 8.78MB
13、 ruff-armv7-unknown-linux-gnueabihf.tar.gz.sha256 108B
14、 ruff-armv7-unknown-linux-musleabihf.tar.gz 8.85MB
15、 ruff-armv7-unknown-linux-musleabihf.tar.gz.sha256 109B
16、 ruff-i686-pc-windows-msvc.zip 7.14MB
17、 ruff-i686-pc-windows-msvc.zip.sha256 96B
18、 ruff-i686-unknown-linux-gnu.tar.gz 9.57MB
19、 ruff-i686-unknown-linux-gnu.tar.gz.sha256 101B
20、 ruff-i686-unknown-linux-musl.tar.gz 9.2MB
21、 ruff-i686-unknown-linux-musl.tar.gz.sha256 102B
22、 ruff-installer.ps1 12.67KB
23、 ruff-installer.sh 38.5KB
24、 ruff-powerpc64-unknown-linux-gnu.tar.gz 10.29MB
25、 ruff-powerpc64-unknown-linux-gnu.tar.gz.sha256 106B
26、 ruff-powerpc64le-unknown-linux-gnu.tar.gz 9.9MB
27、 ruff-powerpc64le-unknown-linux-gnu.tar.gz.sha256 108B
28、 ruff-s390x-unknown-linux-gnu.tar.gz 10.73MB
29、 ruff-s390x-unknown-linux-gnu.tar.gz.sha256 102B
30、 ruff-x86_64-apple-darwin.tar.gz 8.12MB
31、 ruff-x86_64-apple-darwin.tar.gz.sha256 98B
32、 ruff-x86_64-pc-windows-msvc.zip 7.88MB
33、 ruff-x86_64-pc-windows-msvc.zip.sha256 98B
34、 ruff-x86_64-unknown-linux-gnu.tar.gz 9.62MB
35、 ruff-x86_64-unknown-linux-gnu.tar.gz.sha256 103B
36、 ruff-x86_64-unknown-linux-musl.tar.gz 9.69MB
37、 ruff-x86_64-unknown-linux-musl.tar.gz.sha256 104B
38、 source.tar.gz 4.71MB
39、 source.tar.gz.sha256 80B