Skip to content

feat: add cyclomatic complexity reducer agentic workflow#298

Merged
jamesadevine merged 3 commits intomainfrom
cyclomatic-complexity-workflow
Apr 22, 2026
Merged

feat: add cyclomatic complexity reducer agentic workflow#298
jamesadevine merged 3 commits intomainfrom
cyclomatic-complexity-workflow

Conversation

@jamesadevine
Copy link
Copy Markdown
Collaborator

Summary

Adds a daily GitHub Agentic Workflow that identifies and refactors functions with high cyclomatic complexity.

Flow

  1. Clippy analysis — runs cargo clippy in JSON mode with clippy::cognitive_complexity enabled
  2. Rank & select — picks the highest-complexity function not already processed
  3. Refactor — applies extract-helper, flatten-nesting, simplify-logic patterns
  4. Verify — runs cargo test + cargo clippy to confirm no regressions
  5. Submit PR — creates a PR with before/after complexity scores
  6. Cache memory — tracks processed functions across runs to avoid duplicates

Design Decisions

  • One function per run — keeps PRs small and reviewable
  • Cache memory — prevents re-processing the same function on consecutive runs
  • Fallback to manual scan — if Clippy threshold is not exceeded, heuristically finds deeply nested functions
  • No behaviour changes — all refactors must preserve existing test outcomes

jamesadevine and others added 3 commits April 22, 2026 08:45
Daily scheduled GitHub Agentic Workflow that:
1. Runs Clippy cognitive complexity analysis in JSON mode
2. Ranks functions by complexity score
3. Refactors the highest-complexity function (extract helpers, flatten nesting, simplify logic)
4. Verifies tests pass and complexity is reduced
5. Submits a PR with the changes
6. Uses cache-memory to track progress across runs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
gh-aw strict mode (default) refuses write permissions — writes happen
through the safe-outputs system (create-pull-request). Align with the
pattern used by all other workflows in this repo.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine jamesadevine merged commit 1066a2f into main Apr 22, 2026
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.

1 participant