Open diceroll123 opened 7 months ago
Do we know what license the Sourcery documentation is distributed under? There might be legal issues with basing implementations on it if it is sufficiently restrictive. Although, it might be fine regardless due to Google v. Oracle. I am not a lawyer; this is not legal advice.
Also not a lawyer, but my intention here is the (surprisingly not the software development methodology of) clean room design.
After all, this issue's a proposal, and I would say nobody has the copyright over an idea of a lint rule, especially if we can't see the source to replicate it.
In any case, I leave it up to the team to decide!
Hello @diceroll123 is this list updated with Ruff 0.7.x new rules? Asking that just to know if we need to check, thanks
@rogelho-junior-byx I have not once updated the list since making this issue, would like to hear back from Astral folks before anyone spends time on it tbh 🫠
Sourcery is a closed-source, paid program with refactoring/suggestion rules, some of which are covered by existing rules within Ruff.
Since Sourcery is closed-source, the rules would need to be clean room implementations.
Below, I've enumerated all current Sourcery rules with any overlap with Ruff
0.4.1
, for Astral's consideration.Note: There is of course the possibility that some unimplemented rules below are equivalent to different unimplemented rules from different libraries, such as Pylint.
I expect that any implementations made would fall under
RUF
(if there is no unimplemented alternative from another set of rules)?(assign-if-exp
SIM108
)(aug-assign
PLR6104
)(avoid-builtin-shadow
A001
)(aware-datetime-for-utc
DTZ003
implemented but no autofix in Ruff)bin-op-identity
(boolean-if-exp-identity
SIM210
)(break-or-continue-outside-loop
F701
)chain-compares
class-extract-method
(class-method-first-arg-name
N804
)(collection-builtin-to-comprehension
C400
,C401
,C402
)(collection-into-set
PLR6201
)(collection-to-bool
F634
)compare-via-equals
(comprehension-to-generator
C419
)convert-any-to-in
(convert-to-enumerate
SIM113
)dataframe-append-to-concat
(de-morgan
SIM208
)(default-get
SIM401
)(default-mutable-arg
B006
)del-comprehension
dict-assign-update-to-union
dict-comprehension
(dict-literal
C408
)(do-not-use-bare-except
E722
)dont-import-test-modules
(ensure-file-closed
SIM115
)(equality-identity
PLR0133
+PLR0124
)extract-duplicate-method
extract-method
flatten-nested-try
(flip-comparison
SIM300
)(for-append-to-extend
PERF401
)for-index-replacement
(for-index-underscore
B004
)guard
hoist-if-from-if
hoist-loop-from-if
hoist-repeated-if-condition
hoist-similar-statement-from-if
hoist-statement-from-if
hoist-statement-from-loop
(identity-comprehension
C416
)(inline-immediately-returned-variable
RET504
)inline-immediately-yielded-variable
inline-variable
(instance-method-first-arg-name
N805
)introduce-default-else
invert-any-all
invert-any-all-body
(last-if-guard
RET505
)lift-duplicated-conditional
lift-return-into-if
(list-comprehension
PERF401
)(list-literal
C408
)low-code-quality
max-min-default
(similar toSIM108
but not quite the same)merge-assign-and-aug-assign
(merge-comparisons
PLR1714
)merge-dict-assign
(merge-duplicate-blocks
SIM114
)(merge-else-if-into-elif
PLR5501
)merge-except-handler
(merge-isinstance
PLR1701
+SIM101
)(merge-list-append
FURB113
)merge-list-appends-into-extend
merge-list-extend
(merge-nested-ifs
SIM102
)merge-repeated-ifs
merge-set-add
method_chaining
min-max-identity
(partially covered byPLR2004
)(missing-dict-items
PLE1141
)move-assign
move-assign-in-block
no-conditionals-in-tests
no-loop-in-tests
non-equal-comparison
(none-compare
E711
)(or-if-exp-identity
FURB110
)(pandas-avoid-inplace
PD002
)(path-read
FURB101
)(raise-from-previous-error
B904
)(raise-specific-error
TRY002
)reintroduce-else
remove-assert-true
(remove-dict-items
PERF102
+SIM118
)(remove-dict-keys
SIM118
)remove-duplicate-dict-key
(remove-duplicate-set-key
B033
)remove-empty-nested-block
(remove-none-from-default-get
SIM910
)remove-pass-body
remove-pass-elif
remove-redundant-boolean
remove-redundant-condition
remove-redundant-constructor-in-dict-union
remove-redundant-continue
remove-redundant-except-handler
remove-redundant-exception
(remove-redundant-fstring
F541
)remove-redundant-if
remove-redundant-pass
remove-redundant-path-exists
remove-redundant-slice-index
(remove-str-from-fstring
RUF010
)remove-str-from-print
remove-unit-step-from-range
remove-unnecessary-cast
(remove-unnecessary-else
RET505
)remove-unreachable-code
remove-unused-enumerate
(remove-zero-from-range
PIE808
)replace-apply-with-method-call
replace-apply-with-numpy-operation
(replace-dict-items-with-values
PERF102
)(replace-interpolation-with-fstring
UP031
)(return-or-yield-outside-function
F704
+F706
)(sort-of implemented withset-comprehension
FURB142
)(simplify-boolean-comparison
E712
)simplify-constant-sum
simplify-dictionary-update
simplify-division
simplify-empty-collection-comparison
(partially covered byPLC1901
)simplify-fstring-formatting
simplify-generator
simplify-len-comparison
simplify-negative-index
simplify-numeric-comparison
(simplify-single-exception-tuple
B013
)simplify-str-len-comparison
simplify-substring-search
skip-sorted-list-construction
split-or-ifs
square-identity
str-prefix-suffix
sum-comprehension
swap-if-else-branches
swap-if-expression
swap-nested-ifs
swap-variable
(switch
SIM114
)(ternary-to-if-expression
RUF021
)(tuple-literal
C408
)(unwrap-iterable-construction
C409
)use-any
use-assigned-variable
(use-contextlib-suppress
SIM105
)use-count
(use-datetime-now-not-today
DT002
)use-dict-items
use-dictionary-union
(use-file-iterator
FURB129
)use-fstring-for-concatenation
(use-fstring-for-formatting
UP032
)use-getitem-for-re-match-groups
use-isna
use-itertools-product
use-join
use-len
use-named-expression
use-next
use-or-for-fallback
use-string-remove-affix
use_iloc
(useless-else-on-loop
PLW0120
)while-guard-to-condition
while-to-for
(yield-from
UP028
)