Skip to content

Commit 4d97f64

Browse files
feanilclaude
andcommitted
fix: replace isort pragmas with ruff-equivalent noqa suppressions
isort:skip_file and isort:skip pragmas are not respected by ruff. Replace them with ruff equivalents: - File-level: # ruff: noqa: I001 (cms/__init__.py, cms/wsgi.py, openedx/core/lib/safe_lxml/etree.py, cms/conftest.py) - Line-level: # noqa: I001 (manage.py, cms/urls.py) We also added some suppressions to settings file where the wildcard import and other import ordering is important. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 parent 3522e68 commit 4d97f64

16 files changed

Lines changed: 28 additions & 24 deletions

File tree

cms/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
# ruff: noqa: I001
12
"""
23
Celery needs to be loaded when the cms modules are so that task
34
registration and discovery can work correctly.
45
56
Import sorting is intentionally disabled in this module.
6-
isort:skip_file
77
"""
88

99

cms/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ruff: noqa: I001
12
"""
23
Studio unit test configuration and fixtures.
34
@@ -13,7 +14,7 @@
1314
from openedx.core.pytest_hooks import DeferPlugin
1415

1516
# Patch the xml libs before anything else.
16-
from openedx.core.lib.safe_lxml import defuse_xml_libs # isort:skip
17+
from openedx.core.lib.safe_lxml import defuse_xml_libs # must patch xml libs before other imports execute
1718
defuse_xml_libs()
1819

1920

cms/envs/devstack.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ruff: noqa: I001 - settings file: star-import order is semantically significant
12
"""
23
Specific overrides to the base prod settings to make development easier.
34
"""

cms/envs/docker-production.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ruff: noqa: I001 - settings file: star-import order is semantically significant
12
"""
23
Specific overrides to the base prod settings for a docker production deployment.
34
"""

cms/envs/production.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ruff: noqa: I001 - settings file: star-import order is semantically significant
12
"""
23
Override common.py with key-value pairs from YAML (plus some extra defaults & post-processing).
34

cms/envs/test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
# pylint: disable=wildcard-import, unused-wildcard-import
1414

1515

16-
import os
16+
17+
import os # noqa: I001 - suppresses linting for this whole block, sort imports manually as needed
1718
import tempfile
1819

1920
from django.utils.translation import gettext_lazy
@@ -22,10 +23,10 @@
2223
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType
2324
from openedx.core.lib.derived import derive_settings
2425
from openedx.core.lib.features_setting_proxy import FeaturesProxy
25-
from openedx.envs.test import * # pylint: disable=wrong-import-order
2626
from xmodule.modulestore.modulestore_settings import update_module_store_settings # pylint: disable=wrong-import-order
2727

2828
from .common import *
29+
from openedx.envs.test import * # must come after .common to override Derived values with literals
2930

3031
# A proxy for feature flags stored in the settings namespace
3132
FEATURES = FeaturesProxy(globals())

cms/urls.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@
263263

264264
# Enable Web/HTML Certificates
265265
if settings.FEATURES.get('CERTIFICATES_HTML_VIEW'):
266-
from cms.djangoapps.contentstore.views.certificates import (
266+
from cms.djangoapps.contentstore.views.certificates import ( # noqa: I001 - conditional import inside if block
267267
CertificateActivationAPIView,
268268
CertificateDetailAPIView,
269269
certificates_list_handler,
@@ -342,9 +342,9 @@
342342
]
343343

344344
# pylint: disable=wrong-import-position, wrong-import-order
345-
from edx_django_utils.plugins import get_plugin_url_patterns # isort:skip
345+
from edx_django_utils.plugins import get_plugin_url_patterns # noqa: I001 - must be after urlpatterns are built
346346
# pylint: disable=wrong-import-position
347-
from openedx.core.djangoapps.plugins.constants import ProjectType # isort:skip
347+
from openedx.core.djangoapps.plugins.constants import ProjectType # noqa: I001 - must be after urlpatterns are built
348348

349349
urlpatterns.extend(get_plugin_url_patterns(ProjectType.CMS))
350350

cms/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ruff: noqa: I001
12
"""
23
WSGI config for CMS.
34
@@ -8,7 +9,6 @@
89
``WSGI_APPLICATION`` setting.
910
1011
Import sorting is intentionally disabled in this module.
11-
isort:skip_file
1212
"""
1313

1414
# Patch the xml libs before anything else.

lms/envs/common.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
from corsheaders.defaults import default_headers as corsheaders_default_headers
4646
from django.utils.translation import gettext_lazy as _
47+
from edx_django_utils.plugins import add_plugins, get_plugin_apps
4748
from enterprise.constants import (
4849
DEFAULT_ENTERPRISE_ENROLLMENT_INTENTIONS_ROLE,
4950
ENTERPRISE_ADMIN_ROLE,
@@ -57,11 +58,12 @@
5758
ENTERPRISE_SSO_ORCHESTRATOR_OPERATOR_ROLE,
5859
PROVISIONING_ENTERPRISE_CUSTOMER_ADMIN_ROLE,
5960
PROVISIONING_PENDING_ENTERPRISE_CUSTOMER_ADMIN_ROLE,
60-
SYSTEM_ENTERPRISE_PROVISIONING_ADMIN_ROLE
61+
SYSTEM_ENTERPRISE_PROVISIONING_ADMIN_ROLE,
6162
)
6263
from openedx_content.settings_api import openedx_content_backcompat_apps_to_install
6364
from path import Path as path
6465

66+
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType
6567
from openedx.core.lib.derived import Derived
6668
from openedx.core.lib.features_setting_proxy import FeaturesProxy
6769
from openedx.envs.common import * # pylint: disable=wildcard-import
@@ -2953,13 +2955,6 @@
29532955

29542956
############## Plugin Django Apps #########################
29552957

2956-
from edx_django_utils.plugins import ( # pylint: disable=wrong-import-position,wrong-import-order
2957-
add_plugins,
2958-
get_plugin_apps
2959-
)
2960-
2961-
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType # pylint: disable=wrong-import-position
2962-
29632958
INSTALLED_APPS.extend(get_plugin_apps(ProjectType.LMS))
29642959
add_plugins(__name__, ProjectType.LMS, SettingsType.COMMON)
29652960

lms/envs/devstack.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ruff: noqa: I001 - settings file: star-import order is semantically significant
12
"""
23
Specific overrides to the base prod settings to make development easier.
34
"""

0 commit comments

Comments
 (0)