-
Notifications
You must be signed in to change notification settings - Fork 263
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
Pylint part 1 #2314
Pylint part 1 #2314
Conversation
…not-assigned,no-self-argument,trailing-comma-tuple
…nused-variable, used-before-assignment
…ict-literal, use-list-literal, useless-object-inheritance, useless-super-delegation, using-constant-test
…turn, assignment-from-none, duplicate-key, function-redefined, implicit-str-concat Also update pylint command to include additional sources
…-method, deprecated-module, inconsistent-return-statements, invalid-envvar-default, invalid-overridden-method, invalid-str-returned
…uter-name, redundant-unittest-assert, reimported
@@ -190,7 +190,7 @@ def register_homepage_panels(path, label, homepage_layout): | |||
) | |||
else: | |||
raise TypeError(f"Third level objects need to be an instance of HomePageItem: {group_item}") | |||
panel_perms |= set(group_item.permissions) | |||
panel_perms |= set(group_item.permissions) |
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.
Bugfix here - we were only adding the last group_item.permissions (after the above for
loop terminates) instead of adding the permissions of each group_item in the loop.
@@ -8,27 +8,18 @@ | |||
|
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.
Changes to this file are removing Python 2 backwards compatibility code that's no longer needed. There's probably more that could be done here but this is sufficient to address the immediate pylint warnings.
@@ -84,7 +84,7 @@ def get_permissions_for_model(self, model, actions): | |||
for action in actions: | |||
if action not in ("view", "add", "change", "delete"): | |||
raise ValueError(f"Unsupported action: {action}") | |||
permissions.append("{}.{}_{}".format(model._meta.app_label, action, model._meta.model_name)) | |||
permissions.append("{}.{}_{}".format(model._meta.app_label, action, model._meta.model_name)) |
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.
Another bug fix where we were doing something after the for loop terminates instead of per-iteration of the loop.
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.
Lots of good fixes!
Progress towards: #2292
What's Changed
invoke pylint
task andnautobot-server pylint
command provided by the example plugin. (The latter is needed because of our custom startup code, meaning thatDJANGO_SETTINGS_MODULE=nautobot.core.settings pylint nautobot/
doesn't work on its own)TODO