[refurb] implement hardcoded-string-charset (FURB156)#13530
[refurb] implement hardcoded-string-charset (FURB156)#13530MichaReiser merged 5 commits intoastral-sh:mainfrom
refurb] implement hardcoded-string-charset (FURB156)#13530Conversation
c4cac13 to
40149a1
Compare
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| FURB156 | 3 | 3 | 0 | 0 | 0 |
crates/ruff_linter/src/rules/refurb/rules/hardcoded_string_charset.rs
Outdated
Show resolved
Hide resolved
MichaReiser
left a comment
There was a problem hiding this comment.
Thanks. This looks great.
I left a few smaller comments. It would also be great to add some documentation to Charset and bitset, considering that the representations are non-trivial and make some assumptions about how they're used.
crates/ruff_linter/src/rules/refurb/rules/hardcoded_string_charset.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/refurb/rules/hardcoded_string_charset.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/refurb/rules/hardcoded_string_charset.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/refurb/rules/hardcoded_string_charset.rs
Outdated
Show resolved
Hide resolved
40149a1 to
a4a585d
Compare
MichaReiser
left a comment
There was a problem hiding this comment.
Nice, thanks for following up. Let's add a test for when the expression is parenthesized to verify that the fix is correct (if not, take a look at parenthesized_range.
I also think that we may be able to remove the factory methods on AsciiCharSet and reduce them to just one.
crates/ruff_linter/src/rules/refurb/rules/hardcoded_string_charset.rs
Outdated
Show resolved
Hide resolved
b9b3b64 to
aa0a81a
Compare
MichaReiser
left a comment
There was a problem hiding this comment.
Nice thanks. This looks great!
Summary
Implement
hardcoded-string-charset(FURB156)See:
Test Plan
cargo test