mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Add more Ruff rules (#891)
* ruff: apply rule F * ruff: apply rule E * ruff: apply rule SIM * ruff: apply rule TCH * ruff: apply rule ERA * ruff: apply rule PLW * ruff: apply rule FLY * ruff: apply rule PERF * ruff: apply rules FURB & RUF
This commit is contained in:
@ -14,9 +14,12 @@ IGNORE_PATTERNS = [
|
||||
]
|
||||
|
||||
|
||||
# We override the original staticfiles app according to https://docs.djangoproject.com/en/4.2/ref/contrib/staticfiles/#customizing-the-ignored-pattern-list
|
||||
# However, this is buggy and requires us to have an exact naming of the class like this to be detected
|
||||
# Also, it requires to create all commands in management/commands again or they don't get detected by django
|
||||
# We override the original staticfiles app according to
|
||||
# https://docs.djangoproject.com/en/4.2/ref/contrib/staticfiles/#customizing-the-ignored-pattern-list
|
||||
# However, this is buggy and requires us
|
||||
# to have an exact naming of the class like this to be detected
|
||||
# Also, it requires to create all commands in management/commands again
|
||||
# or they don't get detected by django
|
||||
# Workaround originates from https://stackoverflow.com/a/78724835/12640533
|
||||
class StaticFilesConfig(StaticFilesConfig):
|
||||
"""
|
||||
|
@ -28,10 +28,10 @@ class Command(CollectStatic):
|
||||
def collect_scss(self) -> list[Scss.CompileArg]:
|
||||
files: list[Scss.CompileArg] = []
|
||||
for finder in get_finders():
|
||||
for path, storage in finder.list(
|
||||
for path_str, storage in finder.list(
|
||||
set(self.ignore_patterns) - set(IGNORE_PATTERNS_SCSS)
|
||||
):
|
||||
path = Path(path)
|
||||
path = Path(path_str)
|
||||
if path.suffix != ".scss":
|
||||
continue
|
||||
files.append(
|
||||
|
@ -10,7 +10,7 @@ from staticfiles.processors import OpenApi, Webpack
|
||||
|
||||
|
||||
class Command(Runserver):
|
||||
"""Light wrapper around the statics runserver that integrates webpack auto bundling"""
|
||||
"""Light wrapper around default runserver that integrates webpack auto bundling."""
|
||||
|
||||
def run(self, **options):
|
||||
# OpenApi generation needs to be before webpack
|
||||
|
@ -83,7 +83,7 @@ class OpenApi:
|
||||
|
||||
@classmethod
|
||||
def compile(cls):
|
||||
"""Compile a typescript client for the sith API. Only generates it if it changed"""
|
||||
"""Compile a TS client for the sith API. Only generates it if it changed."""
|
||||
logging.getLogger("django").info("Compiling open api typescript client")
|
||||
out = cls.OPENAPI_DIR / "schema.json"
|
||||
cls.OPENAPI_DIR.mkdir(parents=True, exist_ok=True)
|
||||
@ -110,4 +110,4 @@ class OpenApi:
|
||||
with open(out, "w") as f:
|
||||
_ = f.write(schema)
|
||||
|
||||
subprocess.run(["npx", "openapi-ts"]).check_returncode()
|
||||
subprocess.run(["npx", "openapi-ts"], check=True)
|
||||
|
Reference in New Issue
Block a user