acl-org / acl-org/acl-anthology
Upgrading ruff to v0.16
- Dominant language
- Python
- Stars
- 796
- Forks
- 408
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 34
Description
I’ve looked into upgrading ruff from our current version 0.14.14 to the newest 0.16.1; turns out that ruff now enables _a lot_ more rules by default, as it finds 1137 errors (sic) in our codebase. I haven’t had time to go through all of this yet; I assume that some of this will be sensible while we may want to exclude other rules.
A common one is **I001: unsorted-imports**, which expects imports at the top of a Python file to be alphabetically sorted. How do we feel about this? In principle, I do kind of like this as it creates more consistency, though it does create a ton of changed files (176).
I’ll paste the full list of new error codes in our repo below, and will update this once I’ve had time to take a closer look.
```
251 LOG015 [ ] root-logger-call
176 I001 [*] unsorted-imports
171 UP045 [-] non-pep604-annotation-optional
84 UP006 [*] non-pep585-annotation
60 UP009 [*] utf8-encoding-declaration
57 UP032 [*] f-string
43 UP035 [-] deprecated-import
22 PLR0402 [*] manual-from-import
21 BLE001 [ ] blind-except
21 TRY002 [ ] raise-vanilla-class
20 PLR1722 [ ] sys-exit-alias
17 SIM115 [ ] open-file-with-context-handler
16 RUF100 [*] unused-noqa
14 DTZ005 [ ] call-datetime-now-without-tzinfo
12 EXE001 [ ] shebang-not-executable
10 RUF059 [ ] unused-unpacked-variable
10 SIM102 [ ] collapsible-if
9 C401 [ ] unnecessary-generator-set
9 C405 [ ] unnecessary-literal-set
9 SIM118 [-] in-dict-keys
9 TRY401 [ ] verbose-log-message
7 RUF010 [*] explicit-f-string-type-conversion
6 SIM905 [*] split-static-string
5 B006 [ ] mutable-argument-default
5 C414 [ ] unnecessary-double-cast-or-process
5 EXE002 [ ] shebang-missing-executable-file
5 FURB188 [*] slice-to-remove-prefix-or-suffix
4 C403 [ ] unnecessary-list-comprehension-set
4 FLY002 [ ] static-join-to-f-string
4 FURB167 [*] regex-flag-alias
3 C408 [ ] unnecessary-collection-call
3 PIE810 [ ] multiple-starts-ends-with
3 TRY004 [ ] type-check-without-type-error
3 TRY201 [ ] verbose-raise
2 B015 [ ] useless-comparison
2 B019 [ ] cached-instance-method
2 B020 [ ] loop-variable-overrides-iterator
2 FURB192 [ ] sorted-min-max
2 PERF102 [ ] incorrect-dict-iterator
2 PIE790 [*] unnecessary-placeholder
2 PLC0206 [ ] dict-index-missing-items
2 RUF015 [ ] unnecessary-iterable-allocation-for-first-element
2 RUF022 [*] unsorted-dunder-all
2 SIM117 [ ] multiple-with-statements
2 TC004 [ ] runtime-import-in-type-checking-block
1 B009 [*] get-attr-with-constant
1 B018 [ ] useless-expression
1 C400 [ ] unnecessary-generator-list
1 DTZ007 [ ] call-datetime-strptime-without-zone
1 DTZ011 [ ] call-date-today
1 F401 [*] unused-import
1 PIE808 [*] unnecessary-range-start
1 PLR1730 [*] if-stmt-min-max
1 PLR2044 [*] empty-comment
1 PYI016 [*] duplicate-union-member
1 RET501 [*] unnecessary-return-none
1 RUF012 [ ] mutable-class-default
1 RUF013 [ ] implicit-optional
1 SIM103 [ ] needless-bool
1 SIM113 [ ] enumerate-for-loop
1 UP007 [*] non-pep604-annotation-union
1 UP012 [*] unnecessary-encode-utf8
Found 1137 errors.
[*] 641 fixable with the `--fix` option (99 hidden fixes can be enabled with the `--unsafe-fixes` option).
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.