refactor!: port shell scripts to Python package
Bash scripts were untestable and duplicated device/LUKS/mount logic; the lim/ package centralizes it behind one subprocess wrapper and a YAML image catalog (single point of truth). BREAKING CHANGE: scripts/*.sh removed. Use `lim --type <cmd>`; new types mount/umount/single-boot/raid1-boot/lock/unlock/import/export replace direct script calls. --extra is deprecated and ignored. - distributions.yml + lim/catalog.py hold the image catalog (PyYAML) - pytest suite: 102 tests with mocked subprocess (tests/unit) and a 250-line max file-length guard (tests/lint) - ruff strict (select ALL), GitHub Actions CI, Dependabot; Travis gone - Makefile: install (symlink ~/.local/bin/lim) and test targets - fixes over bash: SUDO_USER-aware chown, mmcblk/nvme partition paths, sha512 checksum support, whole-pipeline failure detection, blkid UUID fallback for pre-mounted images, conditional fstab seeding for PARTUUID/LABEL images, clean errors for missing binaries
This commit is contained in:
0
tests/lint/__init__.py
Normal file
0
tests/lint/__init__.py
Normal file
19
tests/lint/test_file_length.py
Normal file
19
tests/lint/test_file_length.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""Architecture guard: keep modules small (KISS/SRP)."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
MAX_LINES = 250
|
||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
CHECKED_GLOBS = ("main.py", "lim/**/*.py", "tests/**/*.py")
|
||||
|
||||
|
||||
def test_source_files_stay_below_max_lines():
|
||||
offenders = {
|
||||
str(path.relative_to(REPO_ROOT)): length
|
||||
for pattern in CHECKED_GLOBS
|
||||
for path in sorted(REPO_ROOT.glob(pattern))
|
||||
if (length := len(path.read_text().splitlines())) > MAX_LINES
|
||||
}
|
||||
assert not offenders, (
|
||||
f"Files exceeding {MAX_LINES} lines (split them, see KISS/SRP): {offenders}"
|
||||
)
|
||||
Reference in New Issue
Block a user