File: lint

package info (click to toggle)
python-wyoming 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 376 kB
  • sloc: python: 3,025; makefile: 3
file content (26 lines) | stat: -rwxr-xr-x 863 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python3
import subprocess
import venv
from pathlib import Path

_DIR = Path(__file__).parent
_PROGRAM_DIR = _DIR.parent
_VENV_DIR = _PROGRAM_DIR / ".venv"
_MODULE_DIR = _PROGRAM_DIR / "wyoming"
_TESTS_DIR = _PROGRAM_DIR / "tests"

if _VENV_DIR.exists():
    context = venv.EnvBuilder().ensure_directories(_VENV_DIR)
    python_exe = context.env_exe
else:
    python_exe = "python3"

subprocess.check_call(
    [python_exe, "-m", "black", str(_MODULE_DIR), str(_TESTS_DIR), "--check"]
)
subprocess.check_call(
    [python_exe, "-m", "isort", str(_MODULE_DIR), str(_TESTS_DIR), "--check"]
)
subprocess.check_call([python_exe, "-m", "flake8", str(_MODULE_DIR), str(_TESTS_DIR)])
subprocess.check_call([python_exe, "-m", "pylint", str(_MODULE_DIR), str(_TESTS_DIR)])
subprocess.check_call([python_exe, "-m", "mypy", str(_MODULE_DIR), str(_TESTS_DIR)])