Problem
Two issues with gaze quality --min-contract-coverage output:
1. Usage text appears mid-output
The Cobra usage/help text appears in the middle of threshold violation messages, not at the end:
TestAnalyzeReturns_Direct_PureFunction: contract coverage 0% is below minimum 100%
Usage:
gaze quality [packages...] [flags]
...
TestReturns_PureFunction: contract coverage 0% is below minimum 100%
This suggests either two separate code paths emit violation messages (one before and one after RunE returns its error),
or stderr buffering causes interleaving.
2. Duplicate violation lines
Many test-target pairs produce the same violation message twice:
TestAnalyzeP1Effects_Direct_ChannelSend: contract coverage 0% is below minimum 100%
TestAnalyzeP1Effects_Direct_ChannelSend: contract coverage 0% is below minimum 100%
Reproduction
gaze quality ./internal/analysis/ --min-contract-coverage=100
Expected Behavior
- Each violation message should appear exactly once
- No usage text in the output (threshold violations are runtime errors, not usage errors)
Investigation
- Add
SilenceUsage: true to the root Cobra command to fix the usage text issue
- Trace the threshold check code path to find where violations are printed — look for two separate loops or a loop that runs over both per-package and merged results
- Deduplicate violation messages
Problem
Two issues with
gaze quality --min-contract-coverageoutput:1. Usage text appears mid-output
The Cobra usage/help text appears in the middle of threshold violation messages, not at the end:
This suggests either two separate code paths emit violation messages (one before and one after
RunEreturns its error),or stderr buffering causes interleaving.
2. Duplicate violation lines
Many test-target pairs produce the same violation message twice:
Reproduction
Expected Behavior
Investigation
SilenceUsage: trueto the root Cobra command to fix the usage text issue