Skip to content

[Housekeeping]: Standardize linting on Ruff (remove legacy linters/formatters) #284

@pheus

Description

@pheus

Proposed Changes

  • Adopt Ruff as the single linter+formatter (ruff check + ruff format).
  • Remove legacy tools and their configs:
    • flake8 (and delete the .flake8 file)
    • black
    • isort
    • pyupgrade
    • add-trailing-comma
    • pylint config (if present)
  • Pre-commit:
    • Replace the above hooks with Ruff hooks only:
      • ruff format (autofix on local)
      • ruff check (with --fix locally; --diff/no-fix in CI)
  • pyproject.toml:
    • Remove any [tool.black], [tool.isort], [tool.ruff], [tool.pylint] sections so pyproject.toml contains only project/build metadata.
    • Make ruff.toml the single source of truth for Ruff settings.
  • Ruff configuration:
  • CI:
    • Update GitHub Actions (and any Makefile targets) to run only Ruff:
      • ruff format --check .
      • ruff check .
    • Remove any steps invoking removed tools.
  • Docs:
    • Update CONTRIBUTING.md / README references to mention Ruff + pre-commit and drop mentions of Black/Flake8/Isort/PyUpgrade.
    • Example contributor setup:
      python -m pip install ruff pre-commit
      pre-commit install
      

Justification

  • Single, fast toolchain: Ruff replaces the combined roles of Flake8/Isort/PyUpgrade and can format code à la Black, reducing maintenance and speeding up local dev and CI.
  • Consistency with other NetBox plugins: Aligns the style with netbox-aci-plugin and simplifies cross-repo contributions.
  • Matches current NetBox dev guidance: NetBox docs demonstrate using Ruff + pre-commit as the standard developer workflow.
  • Lower config complexity: One ruff.toml at the root avoids conflicting settings spread across multiple tools and pyproject.toml.

Tasks / Checklist

  • Delete .flake8.
  • Remove black, flake8, isort, pyupgrade, add-trailing-comma hooks from .pre-commit-config.yaml.
  • Keep only Ruff hooks:
    • ruff format (local autofix)
    • ruff check (local --fix; CI --diff)
  • Remove [tool.black], [tool.isort], [tool.ruff], [tool.pylint] from pyproject.toml (if present).
  • Add/align ruff.toml using the config from netbox-aci-plugin, adjusted for netbox_acls.
  • Ensure make lint (or equivalent) uses Ruff only.
  • Update GitHub Actions to run Ruff only.
  • Update contributor docs to Ruff + pre-commit.
  • Run repository‑wide ruff format + ruff check --fix and commit style‑only changes.

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions