Skip to content

Add Ruff linter with CI integration#44

Merged
jserv merged 1 commit intomainfrom
lint
Feb 20, 2026
Merged

Add Ruff linter with CI integration#44
jserv merged 1 commit intomainfrom
lint

Conversation

@jserv
Copy link
Copy Markdown
Contributor

@jserv jserv commented Feb 20, 2026

This integrates Ruff as static analysis linter alongside the existing black formatter. The pyproject.toml configures targeted rule categories (Pyflakes, pycodestyle, pyupgrade, flake8-bugbear, flake8-builtins, and select pylint rules) with per-file ignores for structural patterns like tkinter wildcard imports and module-level globals in TUI/GUI code.

Code fixes applied across all three source files:

  • Convert 189 .format() calls to f-strings
  • Replace EnvironmentError/IOError aliases with OSError (16 sites)
  • Remove useless (object) inheritance from 5 classes
  • Add 'from e' to 2 re-raised exceptions for proper chaining
  • Eliminate mutable default arguments in cache functions by using module-level lists with .clear() on re-entry
  • Simplify comparisons with 'in', max(), and direct function refs
  • Modernize super() call and from-import style
  • Remove dead variable assignment and update stale docstrings

Close #11


Summary by cubic

Add Ruff linter with CI enforcement and project config. Cleaned up code to satisfy lint rules, fixed cached-node state leakage in TUI/GUI search, and corrected the option-env warning message arguments.

  • Refactors

    • Converted .format() calls to f-strings.
    • Standardized exceptions (use OSError, add chaining, avoid bare except).
    • Modernized imports and super(); removed redundant “object” bases.
    • Simplified comparisons and control flow.
  • Bug Fixes

    • Cleared cached node lists on TUI/GUI re-entry to prevent stale search results.
    • Fixed option-env warning to use the correct argument order.

Written for commit 460ab77. Summary will update on new commits.

cubic-dev-ai[bot]

This comment was marked as resolved.

This enables Ruff static analysis across all installable modules with
pyproject.toml configuration. Convert .format() calls to f-strings,
modernize exception handling (EnvironmentError/IOError -> OSError,
bare except -> except Exception, class Foo(object) -> class Foo,
super(Cls, self) -> super()), and fix a pre-existing bug where the
option-env warning had its arguments swapped.

Rule coverage: F, E, W, UP, B, A, PLE, PLW, PLR1714/1730/0402, BLE,
S102/S110/S301/S307/S602, SIM115. Intentional patterns suppressed via
scoped per-file-ignores.
@jserv jserv merged commit 28c19a0 into main Feb 20, 2026
9 checks passed
@jserv jserv deleted the lint branch February 20, 2026 16:06
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.

Tweak for Pylint

1 participant