From 49158e742c23470f28a004ab5a421a19d8b75f80 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Mon, 2 Jun 2025 13:43:10 -0400 Subject: [PATCH] build: Move the pylint_django_settings plugin. When it was located at the root of the project, it was sometimes not getting loaded correctly since the root of the project is not a python module, and producing the following error: ``` Command line or configuration file:1:0: E0013: Plugin 'pylint_django_settings' is impossible to load, is it installed ? ('No module named 'pylint_django_settings'') (bad-plugin-value) ``` This led all the pylint tests to fail. This started happening more as we updated other dependencies via make upgrade for some reason and led to inconsistent builds. The move should hopefully make the loading reliable and consistent. --- .editorconfig | 4 ++-- .../core/tests/pylint_django_settings.py | 7 ++++++- pylintrc | 6 +++--- pylintrc_tweaks | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) rename pylint_django_settings.py => openedx/core/tests/pylint_django_settings.py (85%) diff --git a/.editorconfig b/.editorconfig index abc3b2a34b..fbc3ba7985 100644 --- a/.editorconfig +++ b/.editorconfig @@ -64,7 +64,7 @@ # SERIOUSLY. # # ------------------------------ -# Generated by edx-lint version: 5.3.0 +# Generated by edx-lint version: 5.6.0 # ------------------------------ [*] end_of_line = lf @@ -97,4 +97,4 @@ max_line_length = 72 [*.rst] max_line_length = 79 -# eecef7d3f7f334de2348fe1b4b0b48d605f7dcab +# 3eb1e01bd9ba6cdf1e5d0a493581c4ea14404b67 diff --git a/pylint_django_settings.py b/openedx/core/tests/pylint_django_settings.py similarity index 85% rename from pylint_django_settings.py rename to openedx/core/tests/pylint_django_settings.py index 6051d9ab4b..09ec5871f8 100644 --- a/pylint_django_settings.py +++ b/openedx/core/tests/pylint_django_settings.py @@ -1,3 +1,8 @@ +""" +This is a plugin that helps pylint figure out what DJANGO_SETTINGS_MODULE to use for linting different files. Since the +LMS and CMS files have different expectations about what django settings including which installed apps and settings are +set when the code is run. +""" import os import sys @@ -40,7 +45,7 @@ def register(linter): """ Placeholder function to register the plugin with pylint. """ - pass + return def load_configuration(linter): diff --git a/pylintrc b/pylintrc index de88463ddb..43f2b3bc9e 100644 --- a/pylintrc +++ b/pylintrc @@ -64,12 +64,12 @@ # SERIOUSLY. # # ------------------------------ -# Generated by edx-lint version: 5.4.1 +# Generated by edx-lint version: 5.6.0 # ------------------------------ [MASTER] ignore = ,.git,.tox,migrations,node_modules,.pycharm_helpers persistent = yes -load-plugins = edx_lint.pylint,pylint_django_settings,pylint_django,pylint_celery,pylint_pytest +load-plugins = edx_lint.pylint,openedx.core.tests.pylint_django_settings,pylint_django,pylint_celery,pylint_pytest [MESSAGES CONTROL] enable = @@ -414,4 +414,4 @@ int-import-graph = [EXCEPTIONS] overgeneral-exceptions = builtins.Exception -# 5aea7d7fb264005eb373099c856a54cdfa4f311c +# d6e4348dec0a8eb2752fc4fe02315286c298aeff diff --git a/pylintrc_tweaks b/pylintrc_tweaks index cd8680d4d6..149433fa90 100644 --- a/pylintrc_tweaks +++ b/pylintrc_tweaks @@ -1,7 +1,7 @@ # pylintrc tweaks for use with edx_lint. [MASTER] ignore+ = ,.git,.tox,migrations,node_modules,.pycharm_helpers -load-plugins = edx_lint.pylint,pylint_django_settings,pylint_django,pylint_celery,pylint_pytest +load-plugins = edx_lint.pylint,openedx.core.tests.pylint_django_settings,pylint_django,pylint_celery,pylint_pytest [MESSAGES CONTROL] disable+ =