-
Notifications
You must be signed in to change notification settings - Fork 564
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
rules: use Scope enum instead of constants #1764
Conversation
we should review the rest of the capa code base for similar constructs that we can simplify. |
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.
LGTM, thank you!
edit: well, tests disagree... :)
i think the test failures are in the base branch, too |
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.
LGTM! Thanks!
Do you think there would be any confusion/mix-up regarding the Scopes
and Scope
classes? Should we rename Scopes
to maybe RuleScopes
?
As for the tests, they are failing due to some result document adjustments I believe... I'll work on that and try to get them green again.
i could see that someone might temporarily mix up Scope and Scopes, but mypy should be able to highlight the differences pretty quickly, since they have different shapes. i don't have a strong feeling either way. |
I see. Let's stick to this (what you proposed in this PR) instead then. I'll merge. |
this PR updates code across capa to prefer to use
Scope.FOO
instead ofFOO_SCOPE
. before, we had two ways of doing things. now we have one. preferring to use the enum is better because it lets type checkers reason about the set of values, rather than arbitrary strings.Checklist