Skip to content

fix(#88): wire Xenon complexity gate into CI#99

Merged
longieirl merged 1 commit intomainfrom
fix/88-xenon-complexity-gate
Mar 30, 2026
Merged

fix(#88): wire Xenon complexity gate into CI#99
longieirl merged 1 commit intomainfrom
fix/88-xenon-complexity-gate

Conversation

@longieirl
Copy link
Copy Markdown
Owner

Summary

Wires a blocking Xenon complexity gate into CI. radon was already installed in requirements/ci.txt but no CI step enforced any threshold — this closes that gap.

Three functions in the codebase currently exceed grade C. Rather than using || true (advisory only), the gate is blocking from day one with explicit, documented per-file exclusions for the pre-existing outliers.

Changes

  • .github/workflows/ci.yml: add Complexity gate (Xenon) step to the security job
    • Thresholds: --max-average A --max-modules B --max-absolute C
    • Three files excluded via --exclude with inline justification comments (see below)
    • No || true — gate is hard from day one
  • requirements/ci.txt: replace radon==6.0.1 + mccabe==0.7.0 with xenon>=0.9.0
    • Xenon depends on Radon; mccabe was installed but unused

Exclusions and rationale

File Function Grade Justification
analysis/table_detector.py _detect_text_based_table E (32) Temporary — pdfplumber word-coordinate coupling blocks safe decomposition without characterisation tests. Tracked: #98
templates/template_detector.py get_detection_explanation D (22) Stable — diagnostic method; exhaustive path coverage of all scoring outcomes is inherent to its purpose
commands/init.py init_directories D (26) Stable — CLI entrypoint orchestration; complexity is setup sequencing, not extractable decision logic

Type

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation
  • Security

Testing

  • Tests pass (coverage ≥ 91%)
  • Manually tested
  • make docker-integration passed locally (required when touching Dockerfile, entrypoint.sh, docker-compose.yml, or packages/parser-core/)

Local gate verification: xenon --max-average A --max-modules B --max-absolute C --exclude "..." packages/parser-core/src → exit 0

Checklist

  • Code follows project style
  • Self-reviewed
  • Documentation updated (if needed)
  • No new warnings

Downstream impact

  • This PR changes a public interface in bankstatements_core (exported class, function, or exception)

- Add blocking Xenon step to security job: --max-average A --max-modules B --max-absolute C
- Three files excluded with inline justification comments:
  - table_detector.py: _detect_text_based_table E/32 — temporary, tracked in #98
  - template_detector.py: get_detection_explanation D/22 — stable diagnostic exemption
  - commands/init.py: init_directories D/26 — stable CLI orchestration exemption
- requirements/ci.txt: replace radon==6.0.1 + mccabe==0.7.0 with xenon>=0.9.0
  (xenon depends on radon; mccabe was unused)
- Gate is blocking from day one — no || true
@github-actions github-actions bot added bug Something isn't working documentation Improvements or additions to documentation dependencies ci labels Mar 30, 2026
@longieirl longieirl self-assigned this Mar 30, 2026
@longieirl longieirl merged commit 324493c into main Mar 30, 2026
12 checks passed
@longieirl longieirl deleted the fix/88-xenon-complexity-gate branch March 30, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci dependencies documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants