-
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
[ruff
] Implement invalid-assert-message-literal-argument
(RUF040
)
#14488
base: main
Are you sure you want to change the base?
[ruff
] Implement invalid-assert-message-literal-argument
(RUF040
)
#14488
Conversation
ruff
] Implement non-string-literal-as-assert-message
(RUF035
)ruff
] Implement non-string-literal-as-assert-message
(RUF040
)
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
RUF040 | 11 | 11 | 0 | 0 | 0 |
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.
This is a really clever rule idea, and the ecosystem checks all look like genuine bugs - great job! (May be worth filing some issues in those repos, actually 😄 )
I just have a quibble with the name of the rule (see the comment below), and a question about bytes literals, but otherwise this looks awesome. Thank you!
crates/ruff_linter/src/rules/ruff/rules/non_string_literal_as_assert_message.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/ruff/rules/non_string_literal_as_assert_message.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/ruff/rules/non_string_literal_as_assert_message.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/ruff/rules/non_string_literal_as_assert_message.rs
Outdated
Show resolved
Hide resolved
ruff
] Implement non-string-literal-as-assert-message
(RUF040
)ruff
] Implement invalid-assert-message-literal-argument
(RUF040
)
Summary
This PR implements new rule discussed here.
In short, it searches for assert messages which were unintentionally used as a expression to be matched against.
Test Plan
cargo test
and review ofruff-ecosystem