-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add new check "implicit-flag-alias" #8345
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
Add new check "implicit-flag-alias" #8345
Conversation
…riables, since we have restricted the domain to Integer types Relates to commit b1e87c2.
… back to the original location it was added Relates to commit 6969070.
In particular, this handles usage of the 'enum.auto' utility class, used to allocate suitable enum values automatically
… including py311-modelled representation of potentially-problematic flag members
…e checker's output
…is referred to twice
Ok, my mistake: not one, but four more commits lined up...
…ehension to collect paired overlapping elements
… the same value more than once)
… a common flag value for the integer representation of that standalone bit
…fined sort order)
… and shorten related variable names [skip ci]
…erlap_assignment' (it represents an assignment statement in the code-being-scanned) [skip ci]
… well-defined sort order)" This reverts commit a57e37c.
…s in each flag's binary representation that are set to '1'
Logically reverts commit d2590cf.
for more information, see https://pre-commit.ci
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8345 +/- ##
========================================
Coverage 95.46% 95.47%
========================================
Files 176 177 +1
Lines 18543 18726 +183
========================================
+ Hits 17702 17878 +176
- Misses 841 848 +7
|
The documentation testing selectively enables lint checks based on the filename, so we need to rename the files to match the rule they are documenting
… comparative good/bad cases Co-authored-by: Pierre Sassoulas <[email protected]>
Thanks again @Pierre-Sassoulas :) |
🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉 This comment was generated for commit 1fc1eac |
Checking in to confirm that this looks like it's working as expected in v2.17.0 - I'll watch for any unexpected issues and/or false positives. Tested with v2.17.0: # flag-overlap.py
from enum import IntFlag
class Chroma(IntFlag):
BLEU = 0
RED = 1
BLEU = 2
GRÜNE = 3
黄色 = 4
|
Type of Changes
Description
This changeset implements an
implicit-flag-alias
check that inspects classes derived fromenum.Flag
and looks for member values that share common bit positions.The commented sample code below may help explain:
Closes #8102.
Replaces and continues from #8105 (origin branch accidentally deleted).