-
Notifications
You must be signed in to change notification settings - Fork 0
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
Improve incorrect base class checker #72
Conversation
_CLASS_MAPPING = ( | ||
{ | ||
"incorrect": "django_filters.filters.FilterSet", | ||
"correct": "django_filters.filters.BaseFilterSet", |
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.
"correct": "django_filters.filters.BaseFilterSet", | |
"correct": "nautobot.apps.filters.NautobotFilterSet", |
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.
Fixed
}, | ||
{ | ||
"incorrect": "django.db.models.base.Model", | ||
"correct": "nautobot.core.models.BaseModel", |
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.
Not sure if we support OR but Primary should always be the preferred and base is only used for custom through tables and a few other scenarios.
"correct": "nautobot.core.models.BaseModel", | |
"correct": ["nautobot.apps.models.PrimaryModel","nautobot.apps.models.BaseModel"] |
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.
PrimaryModel
is a BaseModel
descendant. If we want to allow BaseModel
to be used, it covers PrimaryModel
as well.
One simple option is to enforce PrimaryModel
, instead of BaseModel
. In such case, using BaseModel
only would have to be disabled by # pylint: disable=nb-incorrect-base-class
macro.
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.
I vote enforce PrimaryModel
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.
PrimaryModel
is enforced now.
…into u/snaselj-incorrect-base-class
All comments has been addressed, this pull request is ready for review. |
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
Closes NaN
What's Changed
ModelForm
to incorrect classes checker.