Add linting scripts and pipeline (#201)
* Add linting scripts and pipeline
This commit is contained in:
1 parent
5b1d3b75e2
commit
1fc29241b4
24 files changed
+525
-310
No files matched your search
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
import venv
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
_DIR = Path(__file__).parent
|
||||
_PROGRAM_DIR = _DIR.parent
|
||||
_VENV_DIR = _PROGRAM_DIR / ".venv"
|
||||
_MODULE_DIR = _PROGRAM_DIR / "linux_voice_assistant"
|
||||
|
||||
_LINT_DIRS = [_MODULE_DIR]
|
||||
|
||||
if _VENV_DIR.exists():
|
||||
context = venv.EnvBuilder().ensure_directories(_VENV_DIR)
|
||||
python_exe = context.env_exe
|
||||
else:
|
||||
python_exe = "python3"
|
||||
|
||||
# Überprüfen, ob --auto angegeben wurde
|
||||
auto_fix = "--auto" in sys.argv
|
||||
|
||||
if auto_fix:
|
||||
# Automatisch formatieren
|
||||
subprocess.check_call([python_exe, "-m", "isort"] + _LINT_DIRS)
|
||||
else:
|
||||
# Nur prüfen, ob Formatierung korrekt ist
|
||||
subprocess.check_call([python_exe, "-m", "isort"] + _LINT_DIRS + ["--check", "--diff"])
|
||||
Reference in new issue
Block a user