Repository navigation
refactor(complexity): phase 2 — star app and the shellcheck provider - #314
Merged
Merged
Conversation
Second phase of the complexity plan (#312): seven functions under the thresholds by behavior-preserving decomposition. registerStarlarkCommand (37) extracts its four stages (findOrCreateParent, useLineFor, collectFlagValues, defineFlags); Extension.Validate (30) dispatches per command with arg/flag validators; Command.Run (30) extracts buildArgsDict — split once more when the extraction itself scored 23, applyPositionalArgs carrying the positional switch — and setCurrentCommand; flagValue's 24-case switch (26 gocyclo) splits into integer/scalar/collection extractors with a stated fallback chain. shellcheck's parseShellFile (32) moves its scanner state into a functionTracker.observe method and match recording into recordLineMatches; calculateFunctionComplexity (26) extracts branchDelta + countParameterRefs, preserving the case-opens-nothing / esac-closes-floored quirk exactly; isValidFunctionName (17 gocyclo) reads through positive rune predicates. Zero complexity findings remain in the touched files; no new findings anywhere; make vet and full make test pass unmodified; gofmt clean. Plan: docs/plans/complexity-refactors.md (phase 2 complete).
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.
Phase 2 of docs/plans/complexity-refactors.md (#312): seven functions decomposed under gocognit 20 / gocyclo 15, behavior-preserving — the suite passes unmodified. Highlights:
flagValue's 24-case switch splits by type family; shellcheck's scanner state becomes afunctionTrackerwith per-linebranchDeltaaccounting (its nesting quirks preserved exactly);Command.Run's extraction was itself over threshold and split again (applyPositionalArgs). Plan doc rides along with phase 2 marked complete.