Skip to content

Add -summary flag for aggregate error count output#697

Open
fuleinist wants to merge 1 commit into
rhysd:mainfrom
fuleinist:fix/add-summary-flag
Open

Add -summary flag for aggregate error count output#697
fuleinist wants to merge 1 commit into
rhysd:mainfrom
fuleinist:fix/add-summary-flag

Conversation

@fuleinist

Copy link
Copy Markdown

Description

Adds a -summary flag that prints one aggregate line to stderr after checking: N errors in M file(s).

Problem

When integrating actionlint into CI status checks, status badges, or pre-commit hooks, there is no built-in way to get a single-line aggregate summary — users currently have to pipe -oneline output through wc -l to count errors.

Solution

  • New -summary flag (bool) on the command line
  • After linting completes, prints N errors in M file(s) to stderr
  • Composes with -oneline, -format, -no-color, and all other flags
  • Exit codes are unchanged

Implementation

~10 lines in command.go: count the returned []*Error, group by Filepath, and print the aggregate after
unLinter returns.

Fixes #691

When -summary is passed, actionlint prints a single aggregate line to
stderr after checking: 'N errors in M file(s)'. This is useful for CI
status checks, badges, and dashboard integrations that need a stable
one-line summary without parsing the human-readable error layout.

The summary composes with -oneline, -format, -no-color, and all other
flags. Exit codes are unchanged.

Fixes rhysd#691
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add -summary flag for aggregate error count output

1 participant