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

Check for uses of --n #5992

Closed
tjkuson opened this issue Jul 22, 2023 · 1 comment · Fixed by #5998
Closed

Check for uses of --n #5992

tjkuson opened this issue Jul 22, 2023 · 1 comment · Fixed by #5998
Labels
accepted Ready for implementation rule Implementing or modifying a lint rule

Comments

@tjkuson
Copy link
Contributor

tjkuson commented Jul 22, 2023

unary-prefix-increment (B002) warns users about

++n

but not

--n

It would be good if either the rule were changed to check for both, or if a new rule were created to check for unary prefix decrement operators. The rationale is the same; users coming from other languages which support ++ and -- unary prefix operators might not realise that these 'operators' in Python don't do anything, causing subtle bugs.

@charliermarsh charliermarsh added the accepted Ready for implementation label Jul 23, 2023
@charliermarsh
Copy link
Member

Fine with me to add to the existing rule.

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Jul 23, 2023
charliermarsh pushed a commit that referenced this issue Jul 23, 2023
## Summary

Extends `B002` to detect unary decrement prefix operators.

Closes #5992.

## Test Plan

`cargo test`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants