-
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
Use Fields __all__ #70
Conversation
Thanks for doing this, happy to see this!! |
pylint_nautobot/use_fields_all.py
Outdated
) | ||
|
||
|
||
class NautobotUseFieldsAll(BaseChecker): |
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.
Just making sure that we are purposeful, do we want to:
- Create one check for all types (serializer, forms, tables, etc)
- Create one check for each type, using mostly the same code?
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.
@whitej6 WDYT?
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 am 50/50 on this. I see the benefit to have essentially N subclasses with an abstracted method on checking ancestor BUT that adds repetitive code.
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.
We just agreed to go with single checker for all types.
pylint_nautobot/use_fields_all.py
Outdated
_META_CLASSES = ( | ||
"nautobot.utilities.tables.BaseTable.Meta", | ||
# TBD: Add support for other Meta classes | ||
"nautobot.extras.forms.NautobotModelForm.Meta", |
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.
Could you please help me identify all classes that should be checked?
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.
This is the list / thoughts I cam up with:
- NautobotModelSerializer - Yes
- NautobotModelForm - Yes
- NautobotFilterSet - Capability should be added, but does not exist today
- NautobotBulkEditForm - Unclear, in floor app I see it defined, but others I do not, perhaps it is an implied all, in which case I think better to be explicit and convert to respect the all param as best practices)
- NautobotFilterForm - Not needed (can investigate other options for field_order)
- BaseTable - Worth investigation what can be done, but does not exist today and may not be applicable
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.
Added to _META_CLASSES
.
70c9756
to
aa9796f
Compare
aa9796f
to
874f796
Compare
This PR is ready for review @whitej6 @cmsirbu @Kircheneer |
pylint_nautobot/use_fields_all.py
Outdated
# NautobotBulkEditForm - Unclear, in floor app I see it defined, but others I do not, perhaps it is an implied all, in which case I think better to be explicit and convert to respect the all param as best practices) | ||
# NautobotFilterForm - Not needed (can investigate other options for field_order) |
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.
Perhaps better to move the uncertain ones to a new issue and discuss there what else could be added?
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.
FilterForm requires a change upstream before it can be added for __all__
BulkEditForm I do not believe this is applicable since this does not have an ancestor of django.forms.ModelForm
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.
Comments are removed.
All comments has been addressed, 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, thanks!
Closes NaN
What's Changed
nb-use-fields-all
checker.To Do
fields
node value as a failing node.