Files
linux-voice-assistant/script/lint_isort
T
Florian Asche 1fc29241b4 Add linting scripts and pipeline (#201)
* Add linting scripts and pipeline
2026-03-05 01:58:39 +01:00

29 lines
746 B
Python
Executable File

#!/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"])