fix(output): improve violation comprehension in CI/CD mode - #21
Open
B1naryVision wants to merge 1 commit into
Open
fix(output): improve violation comprehension in CI/CD mode#21B1naryVision wants to merge 1 commit into
B1naryVision wants to merge 1 commit into
Conversation
…utput streams When the CI/CD flag was active and any rule exceeded its cicdmaxissues threshold, the tool printed findings for every rule, burying the new violations. The findings JSON also went to stdout while the threshold summary went to stderr, so the two could interleave unpredictably across platforms. - In CI/CD mode, print findings only for rules that breached their cicdmaxissues threshold, with Count updated to match - Write findings and threshold summary sequentially to stdout: issue details first, summary at the bottom - Print an explicit "No rules exceeded their cicdmaxissues threshold." summary when CI/CD mode passes - Extract countFindingsPerRule, getViolatedRuleIds and filterFindingsByRules helpers with unit tests Behavior without the CI/CD flag is unchanged.
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.
Problem
When running with the CI/CD flag (
-j), a single rule breaching itscicdmaxissuesthreshold caused ASIST to print findings for all rules.With e.g. 4 rules at 10 issues each and a cap of 10, introducing 2 new
violations printed ~40 findings, making the 2 new ones very hard to spot.
Additionally, findings JSON was written to stdout while the threshold
summary went to stderr, so output ordering was unpredictable across
platforms and CI log viewers.
Changes
contains only the rules that exceeded their
cicdmaxissueslimit(
Countreflects the filtered total). Exit code behavior is unchanged.both written sequentially to stdout: issue details on top, summary at the
very bottom.
No rules exceeded their cicdmaxissues threshold.instead of silence.countFindingsPerRule,getViolatedRuleIdsand
filterFindingsByRuleshelpers;CheckThresholdViolationskeeps itsexisting signature and output format.
No regression without the flag
Runs without
-jare byte-for-byte unchanged: all findings printed, nothreshold text, exit 0.
Testing
update, and the empty-rule-list edge case; full
go test ./...passes.integrationtests/src:-j+ breach → only breached rule's findings, summary at bottom,stderr empty, exit 1
-j+ no breach → all findings + pass message, exit 0