Skip to content

Strangler-fig: progressively tighten Ruff complexity thresholds #1076

@sergio-sisternes-epam

Description

@sergio-sisternes-epam

Strangler-fig: progressively tighten Ruff complexity thresholds

Labels: tracking, code-quality


Overview

PR #999 introduced Ruff code quality guardrails with complexity thresholds set just above current codebase maximums (strangler-fig pattern). This tracking issue coordinates the progressive tightening of those thresholds through dedicated refactoring PRs.

Current thresholds (baseline from #999)

Metric Threshold Current max Worst offender
max-statements 275 269 mcp_integrator.py::install
max-branches 115 108 mcp_integrator.py::install
max-complexity 100 97 mcp_integrator.py::install
max-args 18 18 commands/install.py
max-returns 18 16 marketplace/publisher.py
file-length (CI) 2400 2316 github_downloader.py

Strangler-fig roadmap

Metric Current Stage 1 Stage 2 Stage 3 Target
max-statements 275 200 120 80 50
max-branches 115 60 40 25 15
max-complexity 100 50 35 20 10
max-args 18 15 12 8 5
max-returns 18 12 8 6 6
file-length 2400 1400 800 500 400

Approach

Each stage is a separate sub-issue. A stage PR must:

  1. Refactor the functions that exceed the new threshold
  2. Update the thresholds in pyproject.toml
  3. Pass uv run ruff check src/ tests/ with the tightened values
  4. Not change functional behaviour (refactor only)

Sub-issues

  • Stage 1: Tame the worst outliers (~5 files)
  • Stage 2: Second-tier tightening (~15 files)
  • Stage 3: Broad refactoring pass (~35 files)
  • Stage 4: Reach target thresholds (~80 files)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/ci-cdGitHub workflows, merge queue, gh-aw integrations, release pipeline.area/cliCLI command surface, flags, help text (cross-cutting).code-qualityCode quality, linting, and complexity guardrailsstatus/acceptedDirection approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).theme/portabilityOne manifest, every target. Multi-target deploy, marketplace, packaging, install.trackingtype/refactorInternal restructure, no behavior change.

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions