Skip to content

Commit ec14a0c

Browse files
committed
fix #2550
1 parent 343485f commit ec14a0c

File tree

1 file changed

+16
-2
lines changed
  • evap/evaluation/management/commands

1 file changed

+16
-2
lines changed

evap/evaluation/management/commands/lint.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,28 @@
44

55

66
class Command(BaseCommand):
7-
args = ""
87
help = "Runs the code linter"
98
requires_migrations_checks = False
109

11-
def handle(self, *args, **options):
10+
def add_arguments(self, parser):
11+
parser.add_argument("linter", nargs="?", choices=["ruff", "pylint", "eslint"], help="Specify a linter to run.")
12+
13+
def run_ruff(self):
1214
self.stdout.write("Executing ruff check .")
1315
subprocess.run(["ruff", "check", "."], check=False) # nosec
16+
17+
def run_pylint(self):
1418
self.stdout.write("Executing pylint evap")
1519
subprocess.run(["pylint", "evap", "tools"], check=False) # nosec
20+
21+
def run_eslint(self):
1622
self.stdout.write("Executing npx eslint --quiet")
1723
subprocess.run(["npx", "eslint", "--quiet"], cwd="evap/static/ts", check=False) # nosec
24+
25+
def handle(self, *args, **options):
26+
if options["linter"] in ("ruff", None):
27+
self.run_ruff()
28+
if options["linter"] in ("pylint", None):
29+
self.run_pylint()
30+
if options["linter"] in ("eslint", None):
31+
self.run_eslint()

0 commit comments

Comments
 (0)