Simplify non-verbose rule output#207
Merged
per1234 merged 3 commits intoarduino:mainfrom Jul 19, 2021
per1234:simplify-non-verbose-output
Merged
Simplify non-verbose rule output#207per1234 merged 3 commits intoarduino:mainfrom per1234:simplify-non-verbose-output
per1234 merged 3 commits intoarduino:mainfrom
per1234:simplify-non-verbose-output
Conversation
An error in the assertion arguments resulted in it providing meaningless results. This also masked the fact that its intended assertion was outdated.
Since output always has had the same format regardless of the tool configuration, with the configuration only determining whether or not it will be printed, it made sense to place the printing control logic at the point of printing, always outputting the message from the result package. It has now been determined that there are different formatting requirements for verbose and non-verbose output. This means that it makes more sense to move that logic to the result package and simply return an empty string when no output should be printed. This refactoring in preparation for the formatting changes to the non-verbose output.
Codecov Report
@@ Coverage Diff @@
## main #207 +/- ##
==========================================
+ Coverage 87.86% 87.90% +0.03%
==========================================
Files 43 43
Lines 4146 4150 +4
==========================================
+ Hits 3643 3648 +5
+ Misses 392 391 -1
Partials 111 111
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Previously, the output resulting from rule violations was always prefaced with the rule ID and result: Rule SD001 result: fail This is necessary in verbose output mode because in that mode the result of every rule applied to the project is printed. This is the only way to identify the rule and result when a rule passes. The situation is different non-verbose mode, where output is only printed when a rule is violated. This means that: - The rule is identified by the rule message - The rule result is implicit So this preface doesn't really serve any purpose in non-verbose mode. It is somewhat cryptic, so may make the output less approachable to the users. Because the rule ID is still sometimes of value as a succinct and unequivocal way to refer to a specific rule, it is printed in a less prominent location at the end of the rule message.
silvanocerza
approved these changes
Jul 19, 2021
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.
Previously, the output resulting from rule violations was always prefaced with the rule ID and result:
This is necessary in verbose output mode because in that mode the result of every rule applied to the project is printed.
This is the only way to identify the rule and result when a rule passes.
The situation is different non-verbose mode, where output is only printed when a rule is violated. This means that:
So this preface doesn't really serve any purpose in non-verbose mode. It is somewhat cryptic, so may make the output less approachable to the users. Because the rule ID is still sometimes of value as a succinct and unequivocal way to refer to a specific rule, it is printed in a less prominent location at the end of the rule message.
Example of non-verbose rule output before this change:
after: