-
Notifications
You must be signed in to change notification settings - Fork 65
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 no namedtuple rule #136
Conversation
Not sure about the test errors here. Can anyone help me? |
I don't know how much community feedback was involved with this rule, but IMHO it is a terrible idea. namedtuple's are totally different than |
@lukuang if you check the error message on Github builds, you'll find this: |
Rules in Fixit doesn't mean they're standard Python convention that needs to be applied everywhere. We found this convention is useful for us for reasons including consistency, performance and usability. So we built this rule. |
fixit/rules/no_namedtuple.py
Outdated
from fixit.common.base import CstLintRule | ||
from fixit.common.utils import InvalidTestCase as Invalid, ValidTestCase as Valid |
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.
Even though this works, the convention is to import those helpers from fixit
to be simpler and consistent to other rules.
https://fixit.readthedocs.io/en/latest/test_a_lint_rule.html#Writing-Unit-Tests
@lukuang thanks for contributing! |
Summary
Introduce a rule that enforces the use of dataclass instead of NamedTuple for better customization and inheritance support
Test Plan
unitests