-
Notifications
You must be signed in to change notification settings - Fork 52
Add rule severity levels and CLI filtering #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Adds a new Severity type ('error', 'warning', 'info') and extends the
Rule interface with DefaultSeverity(). RuleViolation now includes a
Severity field.
The validator automatically assigns a severity to violations using the
rule's default or configuration value.
This change introduces the concept of severity internally without
affecting CLI or output behavior.
Signed-off-by: Mikel Olasagasti Uranga <[email protected]>
Adds --include-info and --errors-only flags to control which violations are displayed. The command now exits with non-zero status only if error-level violations are found. Default behavior: show errors and warnings, hide info-level messages. Also updates tests accordingly. Signed-off-by: Mikel Olasagasti Uranga <[email protected]>
Both the text and JSON formatters now include the severity field for each violation. Default fallback is 'error' for backward compatibility. Tests updated to validate presence and correctness of the severity field. Signed-off-by: Mikel Olasagasti Uranga <[email protected]>
Each rule now defines a default severity level appropriate to its purpose: - UniqueTargets: error - Phonydeclared: warning - MinPhony: warning - MaxBodyLength: info - TimeStampExpanded: warning This ensures consistent severity tagging across all rules. Signed-off-by: Mikel Olasagasti Uranga <[email protected]>
Enhances the 'list-rules' subcommand to display each rule's default severity alongside its description. Signed-off-by: Mikel Olasagasti Uranga <[email protected]>
68eed12 to
3f3d2ad
Compare
|
With this change against https://github.com/reactive-firewall-org/multicast/blob/master/Makefile nothing is shown as Makefile is valid (against current rule set): Same Makefile but with Same Makefile, but a custom config that sets Checking against a Makefile that hits Against a Makefile hitting json output also shows the severity of each hit: And so does |
This PR introduces severity levels for checkmake rules and adds CLI options to control how violations are displayed and handled.
Summary of changes
Severitytype (error,warning,info) torules.RuleViolation.DefaultSeverity().--include-infoshows informational/style-level hints.--errors-onlydisplays only error-level violations.list-rulescommand (new “Severity” column).uniquetargets: errorphonydeclared: warningminphony: warningmaxbodylength: infotimestampexpanded: warningMotivation
Not all rules indicate real errors, some are style or best-practice recommendations.
Introducing severity levels allows users to:
Note
This initial PR doesn't include changes to README or man pages until code changes are approved.
Checklist
Fixes #187