Skip to content

Main pre-commit broken: gocyclo complexity 12 in recEffectiveSavingsPct #1222

Description

@cristim

The pre-commit workflow's gocyclo hook fails on current main:

12 config recEffectiveSavingsPct internal/config/store_postgres_recommendations.go:320:1

recEffectiveSavingsPct was introduced by PR #1206 (merged as cfead3b) with cyclomatic complexity 12, above the hook's -over 10 threshold. The hook runs gocyclo -over 10 over all non-test Go files, so every PR's "Run pre-commit hooks" CI job now fails regardless of what the PR touches (observed on PR #1219, and reproducible locally with gocyclo -over 10 internal/config/store_postgres_recommendations.go on main).

PR #1220 (fix/main-ci-failing-jobs) fixed the lint, govulncheck, and test failures on main but did not address this one.

Fix: refactor recEffectiveSavingsPct to complexity <= 10, for example by extracting the on-demand baseline reconstruction into a helper. Behavior must stay identical (the function's semantics are covered by the #1103/#1148 net-savings rules documented in its comment).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions