Repository: apigee/registry (go)

Issue:
Registry tool: align check and style structures
I noticed that we have a [Severity](https://github.com/apigee/registry/blob/566d11f06d20d41b50291eb5c848a720d72761cf/google/cloud/apigeeregistry/v1/check/check_report.proto#L68) defined for checks and a [Severity](https://github.com/apigee/registry/blob/566d11f06d20d41b50291eb5c848a720d72761cf/google/cloud/apigeeregistry/v1/style/style_guide.proto#L113) defined for style guides. I'm not sure that we would want to merge them, but could they have the same values? One is ordered in increasing severity and the other decreasing.  I don't have a preference for increasing vs. decreasing order, but think that the check Severity, being newer, would be easier to change.

Pull request:
Align Severity enum used for checks with the Severity that we use for style guides.
Fixes #1022

Patch:
diff --git a/cmd/registry/cmd/check/rules/rule111/rule111.go b/cmd/registry/cmd/check/rules/rule111/rule111.go
index f945dc5..5ff1d39 100644
--- a/cmd/registry/cmd/check/rules/rule111/rule111.go
+++ b/cmd/registry/cmd/check/rules/rule111/rule111.go
@@ -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),
 			}}
diff --git a/google/cloud/apigeeregistry/v1/check/check_report.proto b/google/cloud/apigeeregistry/v1/check/check_report.proto
index 71f8c25..d55c50e 100644
--- a/google/cloud/apigeeregistry/v1/check/check_report.proto
+++ b/google/cloud/apigeeregistry/v1/check/check_report.proto
@@ -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.
diff --git a/rpc/check_report.pb.go b/rpc/check_report.pb.go
index c7a0264..ef6fe8b 100644
--- a/rpc/check_report.pb.go
+++ b/rpc/check_report.pb.go
@@ -39,33 +39,40 @@ const (
 	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
 )
 
-// Possible states for this guideline.
+// Possible severities for the violation of a rule.
 type Problem_Severity int32
 
 const (
 	// The default value, unused.
 	Problem_SEVERITY_UNSPECIFIED Problem_Severity = 0
-	// This is a note.
-	Problem_INFO Problem_Severity = 1
-	// This is a strong recommendation.
-	Problem_WARN Problem_Severity = 2
-	// This is an issue and should be resolved.
-	Problem_ERROR Problem_Severity = 3
+	// Violation of the rule is an error that must be fixed.
+	Problem_ERROR Problem_Severity = 1
+	// Violation of the rule is a pattern that is wrong,
+	// and should be warned about.
+	Problem_WARNING Problem_Severity = 2
+	// Violation of the rule is not necessarily a bad pattern
+	// or error, but information the user should be aware of.
+	Problem_INFO Problem_Severity = 3
+	// Violation of the rule is a hint that is provided to
+	// the user to fix their spec's design.
+	Problem_HINT Problem_Severity = 4
 )
 
 // Enum value maps for Problem_Severity.
 var (
 	Problem_Severity_name = map[int32]string{
 		0: "SEVERITY_UNSPECIFIED",
-		1: "INFO",
-		2: "WARN",
-		3: "ERROR",
+		1: "ERROR",
+		2: "WARNING",
+		3: "INFO",
+		4: "HINT",
 	}
 	Problem_Severity_value = map[string]int32{
 		"SEVERITY_UNSPECIFIED": 0,
-		"INFO":                 1,
-		"WARN":                 2,
-		"ERROR":                3,
+		"ERROR":                1,
+		"WARNING":              2,
+		"INFO":                 3,
+		"HINT":                 4,
 	}
 )
 
@@ -304,7 +311,7 @@ var file_google_cloud_apigeeregistry_v1_check_check_report_proto_rawDesc = []byt
 	0x69, 0x67, 0x65, 0x65, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e,
 	0x73, 0x74, 0x79, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x52, 0x08, 0x70,
 	0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72,
-	0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xb8, 0x02,
+	0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xc5, 0x02,
 	0x0a, 0x07, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73,
 	0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52,
 	0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x67, 0x67,
@@ -320,18 +327,19 @@ var file_google_cloud_apigeeregistry_v1_check_check_report_proto_rawDesc = []byt
 	0x2e, 0x61, 0x70, 0x69, 0x67, 0x65, 0x65, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e,
 	0x76, 0x31, 0x2e, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d,
 	0x2e, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, 0x08, 0x73, 0x65, 0x76, 0x65, 0x72,
-	0x69, 0x74, 0x79, 0x22, 0x43, 0x0a, 0x08, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12,
+	0x69, 0x74, 0x79, 0x22, 0x50, 0x0a, 0x08, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12,
 	0x18, 0x0a, 0x14, 0x53, 0x45, 0x56, 0x45, 0x52, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50,
-	0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x46,
-	0x4f, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x41, 0x52, 0x4e, 0x10, 0x02, 0x12, 0x09, 0x0a,
-	0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x42, 0x62, 0x0a, 0x28, 0x63, 0x6f, 0x6d, 0x2e,
-	0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x61, 0x70, 0x69,
-	0x67, 0x65, 0x65, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x73,
-	0x74, 0x79, 0x6c, 0x65, 0x42, 0x10, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x70, 0x6f, 0x72,
-	0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
-	0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x67, 0x65, 0x65, 0x2f, 0x72, 0x65, 0x67, 0x69,
-	0x73, 0x74, 0x72, 0x79, 0x2f, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72,
-	0x6f, 0x74, 0x6f, 0x33,
+	0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52,
+	0x4f, 0x52, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10,
+	0x02, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x48,
+	0x49, 0x4e, 0x54, 0x10, 0x04, 0x42, 0x62, 0x0a, 0x28, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f,
+	0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x67, 0x65, 0x65,
+	0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x73, 0x74, 0x79, 0x6c,
+	0x65, 0x42, 0x10, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72,
+	0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
+	0x6d, 0x2f, 0x61, 0x70, 0x69, 0x67, 0x65, 0x65, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72,
+	0x79, 0x2f, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+	0x33,
 }
 
 var (


Test patch:
diff --git a/cmd/registry/cmd/check/rules/rule111/rule111_test.go b/cmd/registry/cmd/check/rules/rule111/rule111_test.go
index 8a00f53..87371e0 100644
--- a/cmd/registry/cmd/check/rules/rule111/rule111_test.go
+++ b/cmd/registry/cmd/check/rules/rule111/rule111_test.go
@@ -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,
 			}},
 		},
 		{