Skip to content

Add Ruff checking to replace pylint flake8 black and isort, add prek as tooling for local checks, add vscode settings - #380

Open
aryanhasgithub wants to merge 8 commits into
OHF-Voice:mainfrom
aryanhasgithub:dev-tooling
Open

aryanhasgithub wants to merge 8 commits into
OHF-Voice:mainfrom
aryanhasgithub:dev-tooling

Conversation

@aryanhasgithub

@aryanhasgithub aryanhasgithub commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

What does this implement/fix?

Replace Black/isort/flake8/pylint with Ruff, add prek for local hook enforcement

Summary

Consolidates the Python lint/format toolchain onto Ruff, replacing Black, isort, flake8, and pylint. Adds prek (Rust-based pre-commit) to run lint + tests automatically on every commit.

Tooling changes

  • pyproject.toml: [tool.black] and [tool.isort] replaced with [tool.ruff] / [tool.ruff.lint] / [tool.ruff.format]. [tool.pylint.*] sections removed entirely. ruff and prek added to dev extras; black, isort, flake8, pylint, autopep8 removed. Ruff's PL (pylint-equivalent) and B (bugbear) rule sets are enabled, with an ignore list mirroring the checks previously disabled in [tool.pylint."MESSAGES CONTROL"] so effective strictness is preserved.
  • setup.cfg: removed the now-unused [flake8] section.
  • script/lint_flake8script/lint_ruff: renamed and rewritten to run ruff check --fix + ruff format instead of flake8.
  • script/lint_black, script/lint_isort, script/lint_pylint: deleted.
  • script/lint: updated to call lint_ruff + lint_mypy only.
  • mypy is kept as-is for type checking (unrelated to this migration) — fixed a config typo in mypy.ini (python_version >= 3.11python_version = 3.13, the >= was invalid .ini syntax and was silently failing to parse).

New: prek for automatic local enforcement

  • .pre-commit-config.yaml (new): defines two local hooks — lint (./script/lint) and tests (./script/tests, always_run: true) — both run on every commit.
  • script/setup: now runs prek install (and pre-push hook type) automatically as part of --dev setup, so hooks are wired up with zero manual steps for anyone setting up the repo fresh.

VS Code workspace config

  • .vscode/settings.json: removed legacy python.linting.* keys (flake8/mypy linting, python.pythonPath, python.formatting.provider); added Ruff as the default formatter with format-on-save + fix-on-save, Pylance typeCheckingMode: "standard", and pylint.enabled: false.
  • .vscode/launch.json: switched the run config from "type": "python" / program: __main__.py to "type": "debugpy" / module: linux_voice_assistant — fixes a real bug where launching the script directly caused linux_voice_assistant/zeroconf.py to shadow the installed zeroconf package (ModuleNotFoundError: No module named 'zeroconf.asyncio').
  • .vscode/extensions.json: added charliermarsh.ruff to recommendations.

Docs

  • AGENTS.md, README.md, .github/CONTRIBUTING.md, .github/PULL_REQUEST_TEMPLATE.md: updated all lint/test command references from ./script/lint / ./script/tests to prek run lint --all-files / prek run tests --all-files.

CI

  • .github/workflows/lint.yml: removed the separate lint_black, lint_flake8, lint_isort jobs. lint_pylint job renamed to lint_ruff, now runs ./script/lint_ruff. lint_mypy job unchanged.

Minor code fixes (surfaced by Ruff/mypy during migration)

  • linux_voice_assistant/models.py: setattr(oww_model, "wake_word", ...) → direct attribute assignment with # type: ignore[attr-defined]OpenWakeWord (from pyopen_wakeword) doesn't declare this attribute; confirmed via dir() inspection that it's not part of the class's real interface, suppressed rather than removed since downstream behavior wasn't investigated further.
  • linux_voice_assistant/entity.py: simplified a nested if/else into elif (Ruff auto-fix).
  • Several files: removed stray blank lines after class/with/if openers (Ruff formatter).
  • tests/unit/test_unit.py: import linux_voice_assistant.util as utilfrom linux_voice_assistant import util (Ruff import-style fix, applied consistently across all occurrences).

Testing

  • prek run --all-files passes (Ruff + mypy).
  • prek run tests --all-files — all 294 tests pass.

Related issue (if applicable):

  • Fixes #

Types of changes

  • Dependencies bump — dependencies
  • Bugfix (non-breaking change which fixes an issue) — bugfix
  • New feature (non-breaking change which adds functionality) — new-feature
  • Enhancement to an existing feature — enhancement
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) — breaking-change
  • Refactor (no behaviour change) — refactor
  • Documentation only — documentation
  • Maintenance / chore — maintenance
  • CI / workflow change — ci

Checklist

  • The code change is tested and works locally.
  • ./script/lint passes.
  • ./script/tests passes, and tests have been added/updated under tests/ where applicable.

@florian-asche florian-asche added enhancement New feature or request ci labels Aug 2, 2026
@florian-asche florian-asche self-assigned this Aug 2, 2026
@github-actions github-actions Bot removed enhancement New feature or request ci labels Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants