Skip to content

Commit

Permalink
Move noqa pragmas from settings modules to ruff.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
replaceafill committed Jun 4, 2024
1 parent 49833a0 commit 0232d9b
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 28 deletions.
4 changes: 4 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ ignore = [
"UP031",
]

[lint.per-file-ignores]
"src/*/settings/*" = ["F403"]
"src/dashboard/src/settings/*" = ["F405"]

[lint.isort]
force-single-line = true
1 change: 0 additions & 1 deletion src/MCPClient/lib/settings/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
# This file is part of Archivematica.
#
# Copyright 2010-2018 Artefactual Systems Inc. <http://artefactual.com>
Expand Down
1 change: 0 additions & 1 deletion src/MCPClient/lib/settings/testmysql.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
from .test import *

DATABASES = {
Expand Down
1 change: 0 additions & 1 deletion src/MCPServer/lib/settings/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
# This file is part of Archivematica.
#
# Copyright 2010-2018 Artefactual Systems Inc. <http://artefactual.com>
Expand Down
1 change: 0 additions & 1 deletion src/MCPServer/lib/settings/testmysql.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
from .test import *

DATABASES = {
Expand Down
23 changes: 6 additions & 17 deletions src/dashboard/src/settings/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
# This file is part of Archivematica.
#
# Copyright 2010-2017 Artefactual Systems Inc. <http://artefactual.com>
Expand Down Expand Up @@ -418,7 +417,7 @@ def _get_settings_from_file(path):
AUTHENTICATION_BACKENDS = ["django.contrib.auth.backends.ModelBackend"]

# Import basic authentication settings from component module.
from .components.auth import * # noqa
from .components.auth import *

ROOT_URLCONF = "urls"

Expand Down Expand Up @@ -513,16 +512,6 @@ def _get_settings_from_file(path):
r"^api",
r"^jsi18n",
]
# Django debug toolbar
try:
import debug_toolbar # noqa: F401
except:
pass
else:
MIDDLEWARE += ("debug_toolbar.middleware.DebugToolbarMiddleware",)
INSTALLED_APPS += ("debug_toolbar",)
INTERNAL_IPS = ("127.0.0.1", "192.168.82.1", "10.0.2.2")
DEBUG_TOOLBAR_CONFIG = {"INTERCEPT_REDIRECTS": False}

# Dashboard internal settings
GEARMAN_SERVER = config.get("gearman_server")
Expand Down Expand Up @@ -601,14 +590,14 @@ def _get_settings_from_file(path):
"shibboleth.context_processors.logout_link"
]

from .components.shibboleth_auth import * # noqa
from .components.shibboleth_auth import *

LDAP_AUTHENTICATION = config.get("ldap_authentication")
if LDAP_AUTHENTICATION:
ALLOW_USER_EDITS = False
AUTHENTICATION_BACKENDS.insert(0, "components.accounts.backends.CustomLDAPBackend")

from .components.ldap_auth import * # noqa
from .components.ldap_auth import *

CAS_AUTHENTICATION = config.get("cas_authentication")
if CAS_AUTHENTICATION:
Expand All @@ -633,7 +622,7 @@ def _get_settings_from_file(path):
"django_cas_ng.middleware.CASMiddleware",
)

from .components.cas_auth import * # noqa
from .components.cas_auth import *

OIDC_AUTHENTICATION = config.get("oidc_authentication")
if OIDC_AUTHENTICATION:
Expand All @@ -643,13 +632,13 @@ def _get_settings_from_file(path):
LOGIN_EXEMPT_URLS.append(r"^oidc")
INSTALLED_APPS += ["mozilla_django_oidc"]

from .components.oidc_auth import * # noqa
from .components.oidc_auth import *

CSP_ENABLED = config.get("csp_enabled")
if CSP_ENABLED:
MIDDLEWARE.insert(0, "csp.middleware.CSPMiddleware")

from .components.csp import * # noqa
from .components.csp import *

CSP_SETTINGS_FILE = os.environ.get("CSP_SETTINGS_FILE", "")
if CSP_SETTINGS_FILE:
Expand Down
7 changes: 6 additions & 1 deletion src/dashboard/src/settings/components/oidc_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@

OIDC_RP_SIGN_ALGO = os.environ.get("OIDC_RP_SIGN_ALGO", "HS256")


# Username is email address
OIDC_USERNAME_ALGO = lambda email: email # noqa
def _get_email(email):
return email


OIDC_USERNAME_ALGO = _get_email

# map attributes from access token
OIDC_ACCESS_ATTRIBUTE_MAP = {"given_name": "first_name", "family_name": "last_name"}
Expand Down
2 changes: 0 additions & 2 deletions src/dashboard/src/settings/local.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
# This file is part of Archivematica.
#
# Copyright 2010-2017 Artefactual Systems Inc. <http://artefactual.com>
Expand All @@ -21,7 +20,6 @@

from .base import *


DEBUG = True
TEMPLATES[0]["OPTIONS"]["debug"] = True

Expand Down
2 changes: 0 additions & 2 deletions src/dashboard/src/settings/production.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
# This file is part of Archivematica.
#
# Copyright 2010-2017 Artefactual Systems Inc. <http://artefactual.com>
Expand All @@ -19,7 +18,6 @@

from .base import *


ALLOWED_HOSTS = config.get("allowed_hosts").split(",")

SECRET_KEY = config.get("secret_key")
1 change: 0 additions & 1 deletion src/dashboard/src/settings/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
# This file is part of Archivematica.
#
# Copyright 2010-2017 Artefactual Systems Inc. <http://artefactual.com>
Expand Down
1 change: 0 additions & 1 deletion src/dashboard/src/settings/testmysql.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
from .test import *

DATABASES = {
Expand Down

0 comments on commit 0232d9b

Please sign in to comment.