-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[refurb
] implement hardcoded-string-charset
(FURB156)
#13530
Conversation
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thanks. This looks great!
Summary
Implement
hardcoded-string-charset
(FURB156)See:
Test Plan
cargo test