This repository was archived by the owner on Apr 14, 2026. It is now read-only.
fix(hooks): add dart fix step and worktree-safe wrappers#234
Closed
fix(hooks): add dart fix step and worktree-safe wrappers#234
Conversation
3 tasks
Two fixes for pre-commit hooks: 1. dart format can wrap long argument lists to multiple lines without adding trailing commas. flutter analyze --fatal-infos then rejects the result due to require_trailing_commas. Adding dart fix --apply as the first hook step closes this gap. 2. Git sets GIT_DIR in worktrees, which breaks Flutter's version detection (reports 0.0.0-unknown). Wrapper scripts in scripts/ unset GIT_DIR before calling dart/flutter commands. Hook order: dart fix → dart format → flutter analyze
524fd7b to
ec30c15
Compare
Collaborator
|
@runyaga the pre-commit hooks fail on Windows as they're calling |
Collaborator
|
@runyaga We will need to run |
svarlet
approved these changes
Feb 11, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
dart fix --applyas pre-commit hook step beforedart formatunset GIT_DIRfor worktree compatibilityChanges
.pre-commit-config.yaml: Newdart-fixhook runs first; all hooks usescripts/wrappers withlanguage: scriptscripts/dart-fix.sh: UnsetsGIT_DIR, runsdart fix --applyscripts/dart-format.sh: UnsetsGIT_DIR, runsdart formatscripts/flutter-analyze.sh: UnsetsGIT_DIR, runsflutter analyzeProblem
dart formatwraps long argument lists to multiple lines but does not add trailing commas.flutter analyze --fatal-infosthen rejects the result due torequire_trailing_commas. This creates a cycle where format produces code that analyze rejects.Additionally, git worktrees set
GIT_DIRwhich breaks Flutter's SDK version detection (reports0.0.0-unknown), causingflutter analyzeto fail with version resolution errors.Solution
Hook order:
dart fix→dart format→flutter analyzedart fix --applyinserts trailing commas (and other auto-fixable lints) beforedart formattouches whitespace. Wrapper scripts unsetGIT_DIRfor worktree compatibility.Test plan
Generated with Claude Code