Skip to content

bug: Cobra usage text and duplicate threshold messages in gaze quality output #235

Description

@yvonnedevlinrh

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

  1. Add SilenceUsage: true to the root Cobra command to fix the usage text issue
  2. 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
  3. Deduplicate violation messages

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions