- Total Violations: 43 across 9 files
- Most Critical File: cli.py (18 violations - 42% of total)
- Primary Issues: Complex functions with too many branches, statements, arguments
cli.py:62-create_parser(69 statements)cli.py:601-_generate_plan_content(91 statements) ⭐ CRITICALcli.py:977-cmd_exec(127 statements) ⭐ CRITICALenv.py:168-write_devcontainer(56 statements)pr.py:51-build_pr_body(61 statements)report.py:127-maybe_exec(99 statements) ⭐ CRITICALutils/plan_processing.py:29-process_plan_input(63 statements)
cli.py:544-_prepare_plan_config(10 args)cli.py:825-cmd_plan(10 args)cli.py:977-cmd_exec(12 args) ⭐ CRITICALcli.py:1204-_prepare_pr_config(22 args) ⭐ CRITICALcli.py:1380-cmd_pr(22 args) ⭐ CRITICALio/github.py:319-create_or_update_pr(11 args)io/github.py:586-create_issue(6 args)sync.py:24-render_sync_comment(7 args)utils/process.py:176-safe_subprocess_run(7 args)
cli.py:601-_generate_plan_content(complexity: 26) ⭐ CRITICALcli.py:853-cmd_init(complexity: 16)cli.py:977-cmd_exec(complexity: 30) ⭐ CRITICALcli.py:1312-_handle_pr_dry_run(complexity: 15)cli.py:1348-_execute_pr_operations(complexity: 11)cli.py:1443-main(complexity: 12)io/github.py:319-create_or_update_pr(complexity: 13)pr.py:51-build_pr_body(complexity: 17)report.py:127-maybe_exec(complexity: 22) ⭐ CRITICALrules.py:59-_load_plugin_rules(complexity: 11)utils/plan_processing.py:29-process_plan_input(complexity: 18)
cli.py:601-_generate_plan_content(31 branches) ⭐ CRITICALcli.py:853-cmd_init(18 branches)cli.py:977-cmd_exec(33 branches) ⭐ CRITICALcli.py:1312-_handle_pr_dry_run(14 branches)cli.py:1443-main(13 branches)env.py:168-write_devcontainer(18 branches)io/github.py:319-create_or_update_pr(14 branches)pr.py:51-build_pr_body(20 branches)report.py:127-maybe_exec(23 branches) ⭐ CRITICALutils/plan_processing.py:29-process_plan_input(21 branches)
cli.py:853-cmd_init(9 returns)cli.py:977-cmd_exec(14 returns) ⭐ CRITICALcli.py:1443-main(8 returns)report.py:127-maybe_exec(10 returns) ⭐ CRITICAL
Target: Functions with multiple violations and high complexity
-
cmd_exec(cli.py:977) - 5 violations total- 127 statements, 33 branches, 14 returns, 12 args, complexity 30
- Strategy: Split into multiple functions by responsibility
- Extract validation, execution, and result handling
-
_generate_plan_content(cli.py:601) - 3 violations total- 91 statements, 31 branches, complexity 26
- Strategy: Extract sub-functions for different plan generation steps
-
maybe_exec(report.py:127) - 4 violations total- 99 statements, 23 branches, 10 returns, complexity 22
- Strategy: Split execution flow and result processing
Target: Functions with excessive parameter counts
-
_prepare_pr_config(cli.py:1204) - 22 arguments- Strategy: Group related parameters into config objects
-
cmd_pr(cli.py:1380) - 22 arguments- Strategy: Use config object pattern
Target: Functions with 1-2 violations each
cmd_init,build_pr_body,create_or_update_prprocess_plan_input,write_devcontainer
Target: Easier fixes with lower risk
- Functions with 6-11 arguments
- Functions with 50-70 statements
- Config Objects: Group related parameters
- Builder Pattern: For complex function calls
- Dependency Injection: Pass fewer, higher-level objects
- Extract Methods: Pull out logical sub-operations
- Strategy Pattern: Replace conditional logic
- Early Returns: Reduce nesting depth
- Extract Methods: Create smaller focused functions
- Decompose by Responsibility: Split mixed concerns
- Helper Functions: Move reusable code
- Result Objects: Return structured results instead of multiple exit points
- Exception Handling: Use exceptions for error cases
- State Machines: For complex flow control
- Phase 1A: Tackle
cmd_execfunction (highest impact) - Phase 1B: Refactor
_generate_plan_content - Phase 1C: Simplify
maybe_exec - Phase 2: Address high-argument functions
- Phase 3: Medium complexity cleanup
- Phase 4: Final argument/statement cleanup
Success Metrics:
- Reduce violations from 43 → target of <20
- No function >15 complexity, >8 arguments, >40 statements
- All tests continue passing
- CLI behavior unchanged