Repository navigation
fix: fetch full history when cognitive complexity is enabled - #535
Merged
Merged
Conversation
The checkout expression `inputs.run_cognitive_complexity && 0 || 1` always evaluates to `1` because `0` is falsy in GitHub expressions, so the clone stayed shallow and the cognitive complexity step still failed to resolve a merge base. Negate the condition so the truthy branch is non-zero.
Member
Author
|
Validated in VeryGoodOpenSource/very_good_cli#1755 by pointing
For comparison, v2.0.2 ran with |
ryzizub
reviewed
Oct 19, 2026
Gate full-history and shallow checkouts with step-level `if:` instead of computing fetch-depth from the toggle, keeping enable/disable logic separate from clone depth as suggested in review.
Replace the two if-gated checkout steps with a single checkout that reads a job-level FETCH_DEPTH. String literals keep '0' truthy so the full-history branch is actually taken.
ryzizub
approved these changes
Oct 19, 2026
Merged
marcossevilla
added a commit
to VeryGoodOpenSource/very_good_cli
that referenced
this pull request
Oct 19, 2026
v2.0.3 includes the fetch-depth fix (VeryGoodOpenSource/very_good_workflows#535), so the temporary pin to the PR branch is no longer needed.
marcossevilla
added a commit
to VeryGoodOpenSource/very_good_cli
that referenced
this pull request
Oct 19, 2026
* ci: run cognitive complexity audit from very_good_workflows#520 * ci: temporarily force a full cognitive complexity scan * ci: run the build matrix without fail-fast * fix: address review feedback on PR #1755 Co-authored-by: marcossevilla <marcossevilla@users.noreply.github.com> * fix: address review feedback on PR #1755 Co-authored-by: marcossevilla <marcossevilla@users.noreply.github.com> * fix: address review feedback on PR #1755 Co-authored-by: marcossevilla <marcossevilla@users.noreply.github.com> * chore: apply suggestion * ci: migrate remaining workflows to very_good_workflows@v2 Pin every reusable workflow to @v2, drop run_bloc_lint (false is the v2 default), and remove the HEAD diff base, which diffed the checkout against itself and made the complexity scan a no-op. The scan now runs only on the ubuntu matrix leg so both jobs do not race on the sticky PR comment. * ci: fail on cognitive complexity increases Block pull requests that make an existing function more complex relative to the base branch, in addition to the absolute threshold. * fix: address review feedback on PR #1755 Co-authored-by: marcossevilla <marcossevilla@users.noreply.github.com> * ci: run cognitive complexity through very_good_workflows very_good_workflows v2.0.2 checks out full history when run_cognitive_complexity is enabled (VeryGoodOpenSource/very_good_workflows#532), so the dedicated job with its own fetch-depth: 0 checkout is no longer needed. * ci: temporarily validate very_good_workflows#535 Points the build at the PR branch to confirm the fetch-depth fix lets the cognitive complexity step resolve a merge base. Revert to @v2 once the fix is released. * ci: re-validate very_good_workflows#535 * ci: use very_good_workflows@v2 for cognitive complexity v2.0.3 includes the fetch-depth fix (VeryGoodOpenSource/very_good_workflows#535), so the temporary pin to the PR branch is no longer needed. --------- Co-authored-by: unicoderbot[bot] <269805761+unicoderbot[bot]@users.noreply.github.com> Co-authored-by: marcossevilla <marcossevilla@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status
READY
Description
Closes #532
#533 set the checkout depth with
${{ inputs.run_cognitive_complexity && 0 || 1 }}. GitHub expressions treat0as falsy, sotrue && 0gives0,0 || 1gives1, and the clone is always shallow. Because of that, the cognitive complexity step still fails withFailed to resolve merge base for "origin/main"on v2.0.2. See https://github.com/VeryGoodOpenSource/very_good_cli/actions/runs/39242537795: it used4bee65ewithrun_cognitive_complexity: true, but the checkout ran withfetch-depth: 1.This computes the depth once in a job-level
FETCH_DEPTHenv var and has the single checkout step read it, in bothdart_package.ymlandflutter_package.yml:The values are string literals because the string
'0'is truthy in expressions while the number0is not, so a full-history clone is used when cognitive complexity is enabled.Type of Change