Skip to content

Commit

Permalink
Align Severity enum used for checks with the Severity that we use for…
Browse files Browse the repository at this point in the history
… style guides. (#1025)
  • Loading branch information
timburks authored Feb 14, 2023
1 parent 566d11f commit d0fe7e5
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 34 deletions.
2 changes: 1 addition & 1 deletion cmd/registry/cmd/check/rules/rule111/rule111.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var mimeTypeContents = &lint.FieldRule{
detectedType, _, _ := mime.ParseMediaType(detected)
if declaredType != detectedType {
return []*rpc.Problem{{
Severity: rpc.Problem_WARN,
Severity: rpc.Problem_WARNING,
Message: fmt.Sprintf("Unexpected mime_type %q for contents.", declared),
Suggestion: fmt.Sprintf("Detected mime_type: %q.", detected),
}}
Expand Down
2 changes: 1 addition & 1 deletion cmd/registry/cmd/check/rules/rule111/rule111_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestMimeTypeContents(t *testing.T) {
[]*rpc.Problem{{
Message: `Unexpected mime_type "text/html" for contents.`,
Suggestion: `Detected mime_type: "text/plain; charset=utf-8".`,
Severity: rpc.Problem_WARN,
Severity: rpc.Problem_WARNING,
}},
},
{
Expand Down
19 changes: 12 additions & 7 deletions google/cloud/apigeeregistry/v1/check/check_report.proto
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,21 @@ message Problem {
// RuleDocUri provides a uri to the documented explaination of this rule.
string rule_doc_uri = 6;

// Possible states for this guideline.
// Possible severities for the violation of a rule.
enum Severity {
// The default value, unused.
SEVERITY_UNSPECIFIED = 0;
// This is a note.
INFO = 1;
// This is a strong recommendation.
WARN = 2;
// This is an issue and should be resolved.
ERROR = 3;
// Violation of the rule is an error that must be fixed.
ERROR = 1;
// Violation of the rule is a pattern that is wrong,
// and should be warned about.
WARNING = 2;
// Violation of the rule is not necessarily a bad pattern
// or error, but information the user should be aware of.
INFO = 3;
// Violation of the rule is a hint that is provided to
// the user to fix their spec's design.
HINT = 4;
}

// Severity provides information on the criticality of the Problem.
Expand Down
58 changes: 33 additions & 25 deletions rpc/check_report.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d0fe7e5

Please sign in to comment.