Skip to content
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

Custom error message for comparison-with-callable #1130

Merged
merged 5 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### ✨ Enhancements

- Added custom error message for `comparison-with-callable`

### 💫 New checkers

- `redundant-condition`: Provide error message when a conditional statement within a function is guaranteed true. This checker requires `z3` option to be turned on.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ David Kim,
Simeon Krastnikov,
Ryan Lee,
Christopher Li,
Hoi Ching (Herena) Li,
Hayley Lin,
Bruce Liu,
Merrick Liu,
Expand Down
1 change: 1 addition & 0 deletions python_ta/config/messages_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ W0199 = "Calling assert on a tuple will only evaluate to False if it is empty. I

["pylint.checkers.base".ComparisonChecker]
C0123 = "You should use 'isinstance(x, my_type)' instead of 'type(x) == my_type' to check the type of a value."
W0143 = "This expression includes a comparison against a callable. It's likely you meant to call a function but omitted the parenthesis."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use just the term "function" instead of "callable" in the description, as the latter isn't commonly taught for beginners.

And at the end, please say "parenthesis, ()" instead of just "parenthesis", just to be a bit more concrete.


["pylint.checkers.base".NameChecker]
C0104 = "Disallowed name \"%s\". You should give your variables meaningful rather than generic names."
Expand Down
Loading