F401 - Recommend adding unused import bindings to `__all__` #11314
plredmond
marked this pull request as ready for review 1 year ago
zanieb
approved these changes
on 2024-05-14
Revert "patch to remove the unfinished dunder_all mutation"
fe7016ee
charlie patch w/proto dunder_all finder
41584e17
find_dunder_all_expr implemented
61cca6c7
pass ExprList to fix_by_reexporting
453c905a
slight cleanup of branch arms readability
628053ed
rename F401_25__all fixture test to F401_25__all_nonempty
59d96aeb
remove unnecessary pattern match
5b1f3e58
new field in ImportBinding which is the name of the binding
1d16c8be
change fix_bind_reexporting call add_to_dunder_all with the list of b…
ff5f82f7
uncomment and review test cases for F401_25 fixture test
93f0bc31
add edit to insert binding names into __all__
07bd559f
fixture tests to more thoroughly explore the cases of the "add to __a…
4c389502
cargo clippy edits -- map..or to map_or and single-pattern match to i…
f5370cbd
include the binding name in UnusedImport; when it is not the suffix o…
db7cbb5c
accept fixture test changes that show the binding when it differs fro…
1ad23f88
accept stylist argument to place correct quotes around binders added …
2a72d341
use Expr instead of ExprList to convey dunder_all value to the edit-p…
494e56d5
clippy again
a54ea9dc
change make_redundant_alias to take an iter of Cow to simplify caller
99fd1f68
rewrite add_to_dunder_all and its tests
c8dc342b
shakes fist at cloud and yells, "Clippy!!!"
188a232d
change message for redundant-aliases
877800ec
use binding method instead of accessing the field
d5978f9d
use filter_map followed by last to obtain the first __all__ binding
86f30e7a
update fixture test to reflect that we add to the first binding of __…
7f092bf2
fixture test to demonstrate how we treat __all__ followed by a condit…
1d0f3cab
do not offer a fix to add to __all__ when there is more than one __al…
3e284b61
delete F401_29 fixture test
7f3335d0
rename F401_30 fixture test to F401_29
097ce551
add unused-import case to F401_29 fixture test
5beb13f4
change `find_dunder_all_expr` to `find_dunder_all_exprs` and track th…
92a7a43f
change find_dunder_all_exprs to return /all/ such exprs regardless of…
190d1917
change fix-title for redundant alias case to format itself and return…
6035e1d9
use if-let instead of match with empty branch per alex
c81506ae
Update crates/ruff_linter/src/fix/edits.rs
bb545a23
wording improvement per alex
1cbf320d
replace into::Into with Cow::from to make conversion explicit
64c17e25
improve the wording of "add unused import to __all__" message per alex
a7478977
reformat a function -- noop w.r.t. the tests
edc88f3d
remove a now unnecessary branch, which also makes the overall PR diff…
117a1f06
call .end() directly instead of going through .range or .range(); rem…
1b167e61
readd erroneously removed newlines to fixture snaps
26d4714b
ruff format the fixture __init__.py files
5dbdcfe1
cargo insta review -- accept whitespace changes (see `git diff -w`)
64fa9af0
clippy fix -- replace closure with static reference to method
527d3954
plredmond
force pushed
from
31dd04dd
to
527d3954
1 year ago
collect only 2 `__all__` definitions and then stop pulling the iterator
548180b3
Revert "collect only 2 `__all__` definitions and then stop pulling th…
01e974fa
remove the qualified-name field from UnusedImport in favor of the bin…
0696df52
Revert "remove the qualified-name field from UnusedImport in favor of…
dde97562
plredmond
merged
da882b66
into main 1 year ago
plredmond
deleted the ruff.__all__ branch 1 year ago
Assignees
No one assigned
Login to write a write a comment.
Login via GitHub