-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix: bump pylint version #31084
fix: bump pylint version #31084
Conversation
63734d1
to
8d57cbf
Compare
Hi @nedbat |
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.
Two of the warning suppressions should be removed, and the code fixed instead.
@UsamaSadiq The pylint-django-settings.py plugin seems useful, so let's not remove it. If you will be fixing the plugin soon, then maybe an announcement in the #dev channel is enough? I will guess that most devs don't try to run pylint locally anyway. |
I was actually fixing this in another repo edx/portal-designer#195 and determined that we don't put the django settings check in from the cookie cutter these days so I took it out - if we think it's good it probably should also be in the cookie cutter |
Re your issues with the Django settings path, I had what may be a similar issue in openedx-unsupported/blockstore#208 and I fixed it with this: Not sure if that'll be useful here but just letting you know in case it is. |
@@ -91,7 +91,7 @@ def set_dict(self, correct_map): | |||
|
|||
""" | |||
# empty current dict | |||
self.__init__() | |||
self.__init__() # pylint: disable=unnecessary-dunder-call |
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.
Changing the __init__()
call with Class declaration and assigning it to self
as self=CorrectMap()
causes self-cls-assignment
warning to be generated.
Couldn't figure out what should be the way to go about this scenario.
0f35b96
to
dc5c203
Compare
@@ -318,7 +318,7 @@ def start_modulestore_isolation(cls): | |||
|
|||
cls.__old_modulestores.append(copy.deepcopy(settings.MODULESTORE)) | |||
cls.__old_contentstores.append(copy.deepcopy(settings.CONTENTSTORE)) | |||
override.__enter__() | |||
override.__enter__() # pylint: disable=unnecessary-dunder-call |
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.
Refactoring to use ContextManager with
instead as with open(override_settings(...)) as override
causes the unit tests to fail with the error TypeError: expected str, bytes or os.PathLike object, not override_settings
.
Detailed Error Stack Trace: https://github.com/openedx/edx-platform/actions/runs/3265468332/jobs/5367724316#step:7:3517
@@ -101,7 +101,7 @@ def start_cache_isolation(cls): | |||
|
|||
cls.__old_settings.append(copy.deepcopy(settings.CACHES)) | |||
override = override_settings(CACHES=cache_settings) | |||
override.__enter__() | |||
override.__enter__() # pylint: disable=unnecessary-dunder-call |
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 also causes the unit tests to fail upon refactoring. Detailed Error Stack Trace: https://github.com/openedx/edx-platform/actions/runs/3265468332/jobs/5367724316#step:7:3517
missing-timeout, | ||
c-extension-no-member, | ||
no-name-in-module, | ||
unnecessary-lambda-assignment, |
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 some of the lambda assignment warnings. There are still more than ~90 warnings remaining. Fixing all the warnings in the same PR will make the review a lot more difficult so disabling the warning for now so it can be enabled and fixed in a later PR.
The warnings report shows following no of warnings after enabling it:
lms-2
: 27openedx-1
: 6common
: 6cms
: 11xmodule
: 46
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.
Created a follow up issue #31199 for this task.
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.
Why are we manually editing the pylintrc file and not changing the tweeks file...?
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.
The updated pylintrc
file has been generated by the updated pylintrc_tweaks
file. You can see the detailed changes in the pylintrc_tweaks
file the changes section.
fix: drop pylint_django_settings plugin
dc5c203
to
580230c
Compare
@@ -1844,7 +1846,7 @@ def render(self, block, view_name, context=None): | |||
|
|||
""" | |||
context = context or {} | |||
return self.__getattr__('render')(block, view_name, context) | |||
return self.__getattr__('render')(block, view_name, context) # pylint: disable=unnecessary-dunder-call |
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.
Refactoring self.__getattr__('render')
to getattr(self, 'render')
generates C7630: literal-used-as-attribute
warning and using self.render
instead causes the tests to go into infinite recursion.
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.
Rest of the PR looks good except the above question about pylintrc
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
EdX Release Notice: This PR has been deployed to the production environment. |
Description
pylint
constraint and bumped to the latest version.pylintrc_tweaks
andpylintrc
to include new pylint warnings.Major Change
pylint-django-settings
plugin inpylintrc
and instead provided settings path directly in the pylint shards in CI.Follow Up issues