Skip to content

Reduce Ruff ignore list and tighten lint scope #82

Description

@Anselmoo

Problem

Ruff is configured with a very large ignore list and many per-file ignores, masking real issues and making it hard to rely on linting for quality signals. This technical debt blocks enforcing the new COCO/BBOB docstring work and doctest PR (#47).

Current ignores include complexity (C901), branching (PLR0912/15), arguments (PLR0913), naming (N803/N806), magic values (PLR2004), missing docs (D103/D107), numpy legacy RNG (NPY002), print statements (T201), ambiguous names (E741), long lines (E501), trailing commas (COM812), unused variables (F841), and broad per-file exceptions across tests, visualization, benchmarks, and core files.

Goal

Shrink the ignore surface to a minimal, intentional set; document what remains; and enable category-specific enforcement so new work (docstrings, doctests, COCO/BBOB) is not blocked by suppressed rules.

Proposal

  1. Audit & classify rules

    • Identify which ignores are truly needed vs. legacy convenience
    • Group by theme: complexity/branching, naming, style, documentation, numpy RNG, prints, magic values
  2. Reduce global ignores

  3. Scope per-file ignores

    • Trim per-file ignores to only what’s justified; add comments explaining each
    • Keep test/visualization allowances but narrow lists (remove unused ones)
  4. Introduce phased enforcement

    • Phase 0: Baseline report only (no fails) to map violations
    • Phase 1: Enforce on new/modified files (pre-commit target paths)
    • Phase 2: Enforce globally after cleanup
  5. Add documentation

    • Document remaining ignores in pyproject.toml with rationale and sunset plan
    • Add a short docs/development/linting.md describing lint expectations
  6. CI guardrail

    • Add a lint job that fails on newly introduced violations for rules we re-enable

Acceptance Criteria

  • Global ignore list reduced to a minimal, documented set
  • Per-file ignores trimmed and commented
  • Report of current violations attached in the issue (Phase 0)
  • Phase 1 policy: re-enabled rules enforced on new/modified files
  • CI lint job updated to fail on re-enabled rules
  • NPY002 and PLR2004 have a tracked remediation plan (or documented justification)
  • Docstring rules (D103/D107) aligned with COCO/BBOB docstring rollout

Complexity

Medium — requires audit + targeted cleanups across categories.

Dependencies / Related

Suggested Next Steps

  • Run uv run ruff check opt/ --output-format=full and attach summary
  • Draft a proposed new ignore list and per-file ignores with comments
  • Implement Phase 1 (new/modified files) in CI

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions