Skip to content

feat(quality): add ruff/mypy/bandit tooling and fix all issues#73

Merged
adamamyl merged 1 commit into
mainfrom
feature/quality-tooling
May 15, 2026
Merged

feat(quality): add ruff/mypy/bandit tooling and fix all issues#73
adamamyl merged 1 commit into
mainfrom
feature/quality-tooling

Conversation

@adamamyl
Copy link
Copy Markdown
Owner

@adamamyl adamamyl commented May 15, 2026

Summary

  • Add pyproject.toml with ruff, mypy (strict), bandit, pip-audit config
  • Add .pre-commit-config.yaml (ruff, bandit, mypy, betterleaks, standard hooks)
  • Add .github/workflows/quality.yml CI (uv + pre-commit, runs on push/PR)
  • Fix all lint, type, and security issues across 22 existing files

Key fixes

  • Real bugs: run_quiet= kwarg in virtmachine.py (was quiet=, silently did nothing); undefined warn() in github-deploy-key.py (F821)
  • Security: /tmp hardcoded paths → tempfile.NamedTemporaryFile (S108); requests.get missing timeout (S113); bare except: passlog.debug (S110)
  • Types: CustomLogger subclass so mypy strict resolves log.success() cleanly; CompletedProcess[str] type args; argparse.Namespace on untyped args params
  • Lint: wildcard import → explicit; F841 unused vars; E501 line-length throughout

Test plan

  • uv run pre-commit run --all-files passes
  • uv run mypy --package lib --package setup_machine — no issues
  • uv run ruff check . — no issues
  • uv run bandit -c pyproject.toml -r lib setup_machine.py -ll — no issues
  • uv run pip-audit — no known vulnerabilities

- pyproject.toml: ruff, mypy strict, bandit, pip-audit (no vulns)
- .pre-commit-config.yaml: ruff, bandit, mypy, betterleaks, hooks
- .github/workflows/quality.yml: CI via uv + pre-commit

Fixes across 22 files:
- S108 /tmp paths → tempfile.NamedTemporaryFile
- S110 bare except → log.debug
- S113 requests.get missing timeout
- F821 undefined warn() → info() in github-deploy-key.py
- F841 unused key_is_new assignments
- E501 line-length violations throughout
- CustomLogger subclass so mypy resolves log.success() cleanly
- CompletedProcess[str] type args on executor return types
- argparse.Namespace type on setup_fake_le/setup_ollama args param
- run_quiet= kwarg bug in virtmachine (was quiet=, silently wrong)
- wildcard import → explicit from lib.constants import VENVDIR

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@adamamyl adamamyl merged commit d108c5e into main May 15, 2026
1 of 3 checks passed
@adamamyl adamamyl deleted the feature/quality-tooling branch May 15, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant