nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: googleapis/api-linter
Pull request #422 (2019-12-06 16:34:05)

[AIP-136] Use :verb-only suffix when parent variable is included.


Patch:
diff --git a/docs/rules/0136/http-uri-suffix.md b/docs/rules/0136/http-uri-suffix.md
index cd51fad..5107614 100644
--- a/docs/rules/0136/http-uri-suffix.md
+++ b/docs/rules/0136/http-uri-suffix.md
@@ -18,8 +18,8 @@ as mandated in [AIP-136][].
 This rule looks at any method that is not a standard method, and tries to find
 the appropriate suffix at the end of the URI. More specifically:
 
-- If the URI contains a `name` variable, then it expects `:verb` at the end of
-  the URI.
+- If the URI contains a `name` or `parent` variable, then it expects `:verb` at
+  the end of the URI.
 - Otherwise, it expects `:verbNoun` at the end of the URI.
 
 ## Examples
diff --git a/rules/aip0136/http_uri_suffix.go b/rules/aip0136/http_uri_suffix.go
index 78ade5c..6dc7d71 100644
--- a/rules/aip0136/http_uri_suffix.go
+++ b/rules/aip0136/http_uri_suffix.go
@@ -18,6 +18,8 @@ import (
 	"fmt"
 	"strings"
 
+	"github.com/googleapis/api-linter/locations"
+
 	"github.com/googleapis/api-linter/lint"
 	"github.com/googleapis/api-linter/rules/internal/utils"
 	"github.com/jhump/protoreflect/desc"
@@ -35,7 +37,7 @@ var uriSuffix = &lint.MethodRule{
 			//
 			// This is somewhat tricky to test for perfectly, and may need to evolve
 			// over time, but the following rules should be mostly correct:
-			//   1. If the URI contains `{name=`, expect `:verb`.
+			//   1. If the URI contains `{name=` or `{parent=`, expect `:verb`.
 			//   2. Otherwise, expect `:verbNoun`.
 			//
 			// We blindly assume that the verb is always one word (the "noun" may be
@@ -44,7 +46,7 @@ var uriSuffix = &lint.MethodRule{
 			// N.B. The LowerCamel(Snake(name)) is because strcase does not translate
 			//      from upper camel to lower camel correctly.
 			want := ":" + strcase.LowerCamelCase(strcase.SnakeCase(m.GetName()))
-			if strings.Contains(httpRule.URI, "{name=") {
+			if strings.Contains(httpRule.URI, "{name=") || strings.Contains(httpRule.URI, "{parent=") {
 				want = ":" + strings.Split(strcase.SnakeCase(m.GetName()), "_")[0]
 			}
 
@@ -59,6 +61,7 @@ var uriSuffix = &lint.MethodRule{
 						want,
 					),
 					Descriptor: m,
+					Location:   locations.MethodHTTPRule(m),
 				}}
 			}
 		}


Test patch:
diff --git a/rules/aip0136/http_uri_suffix_test.go b/rules/aip0136/http_uri_suffix_test.go
index ec7d78e..469d3e8 100644
--- a/rules/aip0136/http_uri_suffix_test.go
+++ b/rules/aip0136/http_uri_suffix_test.go
@@ -28,6 +28,7 @@ func TestURISuffix(t *testing.T) {
 		problems   testutils.Problems
 	}{
 		{"ValidVerb", "ArchiveBook", "/v1/{name=publishers/*/books}:archive", testutils.Problems{}},
+		{"ValidVerbParent", "ImportBooks", "/v1/{parent=publishers/*}/books:import", testutils.Problems{}},
 		{"InvalidVerb", "ArchiveBook", "/v1/{name=publishers/*/books}:archiveBook", testutils.Problems{{Message: ":archive"}}},
 		{"ValidVerbNounNoVars", "TranslateText", "/v3:translateText", testutils.Problems{}},
 		{"ValidVerbNounNoName", "TranslateText", "/v3/{location=projects/*/locations/*}:translateText", testutils.Problems{}},
Repository: googleapis/api-linter
Pull request #442 (2019-12-11 17:16:50)

[fix] Permit "master" as a version suffix.


Patch:
diff --git a/docs/rules/0215/versioned-packages.md b/docs/rules/0215/versioned-packages.md
index 4bf717a..8b6cb46 100644
--- a/docs/rules/0215/versioned-packages.md
+++ b/docs/rules/0215/versioned-packages.md
@@ -17,7 +17,7 @@ in [AIP-215][].
 
 This rule examines the proto package and complains if it does not end something
 that appears to be a version component, such as `v1` or `v1beta`. It also
-permits proto packages ending in `type`.
+permits proto packages ending in `type` or `master`.
 
 ## Examples
 
diff --git a/rules/aip0215/versioned_packages.go b/rules/aip0215/versioned_packages.go
index 0b26285..ec91a00 100644
--- a/rules/aip0215/versioned_packages.go
+++ b/rules/aip0215/versioned_packages.go
@@ -15,6 +15,7 @@
 package aip0215
 
 import (
+	"fmt"
 	"regexp"
 	"strings"
 
@@ -29,7 +30,13 @@ var versionedPackages = &lint.FileRule{
 		return f.GetPackage() != ""
 	},
 	LintFile: func(f *desc.FileDescriptor) []lint.Problem {
-		if p := f.GetPackage(); !version.MatchString(p) && !strings.HasSuffix(p, ".type") {
+		p := f.GetPackage()
+		for _, exception := range []string{"master", "type"} {
+			if strings.HasSuffix(p, fmt.Sprintf(".%s", exception)) {
+				return nil
+			}
+		}
+		if !version.MatchString(p) {
 			return []lint.Problem{{
 				Message:    "API components should be in versioned packages.",
 				Descriptor: f,


Test patch:
diff --git a/rules/aip0215/versioned_packages_test.go b/rules/aip0215/versioned_packages_test.go
index e544835..429b57d 100644
--- a/rules/aip0215/versioned_packages_test.go
+++ b/rules/aip0215/versioned_packages_test.go
@@ -43,6 +43,7 @@ func TestVersionedPackages(t *testing.T) {
 		{"Test", "package foo.bar.v1test;", testutils.Problems{}},
 		{"Test1", "package foo.bar.v1test1;", testutils.Problems{}},
 		{"Type", "package foo.bar.type;", testutils.Problems{}},
+		{"Master", "package foo.bar.master;", testutils.Problems{}},
 		{"InvalidNoVersion", "package foo.bar;", testutils.Problems{{Message: "versioned packages"}}},
 		{"InvalidSubpackage", "package foo.bar.v1.resources;", testutils.Problems{{Message: "versioned packages"}}},
 		{"IgnoredNoPackage", "", testutils.Problems{}},
Repository: googleapis/api-linter
Pull request #443 (2019-12-11 17:20:51)

[fix] Ignore java_package if version suffix is master.


Patch:
diff --git a/rules/aip0191/java_package.go b/rules/aip0191/java_package.go
index db091d7..0dfb238 100644
--- a/rules/aip0191/java_package.go
+++ b/rules/aip0191/java_package.go
@@ -24,8 +24,10 @@ import (
 )
 
 var javaPackage = &lint.FileRule{
-	Name:   lint.NewRuleName(191, "java-package"),
-	OnlyIf: hasPackage,
+	Name: lint.NewRuleName(191, "java-package"),
+	OnlyIf: func(f *desc.FileDescriptor) bool {
+		return hasPackage(f) && !strings.HasSuffix(f.GetPackage(), ".master")
+	},
 	LintFile: func(f *desc.FileDescriptor) []lint.Problem {
 		javaPkg := f.GetFileOptions().GetJavaPackage()
 		if javaPkg == "" {


Test patch:
diff --git a/rules/aip0191/java_package_test.go b/rules/aip0191/java_package_test.go
index 1079c1b..35b081f 100644
--- a/rules/aip0191/java_package_test.go
+++ b/rules/aip0191/java_package_test.go
@@ -33,6 +33,7 @@ func TestJavaPackage(t *testing.T) {
 			Suggestion: `option java_package = "com.foo.v1";`,
 		}}},
 		{"Ignored", []string{"", ""}, testutils.Problems{}},
+		{"IgnoredMaster", []string{"package foo.master;", ""}, testutils.Problems{}},
 	} {
 		t.Run(test.name, func(t *testing.T) {
 			f := testutils.ParseProto3String(t, strings.Join(test.statements, "\n"))
Repository: googleapis/api-linter
Pull request #523 (2020-03-13 15:25:14)

Don't enforce AIP-0123 on Response messages
In Cloud KMS, we echo the name of the resource used for cryptographic
operations in response messages, so that callers can verify that the
correct resource was used.

(Corruption of a single bit in the `name` field of a request message
could end up with the wrong key being used. We'd like for a caller to be
able to detect when that's happened.)


Patch:
diff --git a/rules/aip0123/aip0123.go b/rules/aip0123/aip0123.go
index d878883..af9d739 100644
--- a/rules/aip0123/aip0123.go
+++ b/rules/aip0123/aip0123.go
@@ -38,7 +38,8 @@ func AddRules(r lint.RuleRegistry) error {
 }
 
 func isResourceMessage(m *desc.MessageDescriptor) bool {
-	return m.FindFieldByName("name") != nil && !strings.HasSuffix(m.GetName(), "Request")
+	return m.FindFieldByName("name") != nil && !strings.HasSuffix(m.GetName(), "Request") &&
+		!strings.HasSuffix(m.GetName(), "Response")
 }
 
 func hasResourceAnnotation(m *desc.MessageDescriptor) bool {


Test patch:
diff --git a/rules/aip0123/resource_annotation_test.go b/rules/aip0123/resource_annotation_test.go
index 273423f..b89dc26 100644
--- a/rules/aip0123/resource_annotation_test.go
+++ b/rules/aip0123/resource_annotation_test.go
@@ -48,6 +48,7 @@ func TestResourceAnnotation(t *testing.T) {
 	}{
 		{"ValidNoNameField", "Book", "title", testutils.Problems{}},
 		{"ValidRequestMessage", "GetBookRequest", "name", testutils.Problems{}},
+		{"ValidResponseMessage", "GetBookResponse", "name", testutils.Problems{}},
 		{"Invalid", "Book", "name", testutils.Problems{{Message: "google.api.resource"}}},
 	} {
 		t.Run(test.name, func(t *testing.T) {
Repository: googleapis/api-linter
Pull request #533 (2020-04-18 00:52:57)

[AIP-122] Permit given_name and family_name as field names.


Patch:
diff --git a/docs/rules/0122/name-suffix.md b/docs/rules/0122/name-suffix.md
index 8afeb0b..1209156 100644
--- a/docs/rules/0122/name-suffix.md
+++ b/docs/rules/0122/name-suffix.md
@@ -17,7 +17,8 @@ This rule enforces that fields do not use the suffix `_name`, as mandated in
 
 This rule scans all fields complains if it sees the suffix `_name` on a field.
 
-**Note:** The standard field `display_name` is exempt.
+**Note:** The standard field `display_name` is exempt, as are `given_name` and
+`family_name` (used to represent the human-readable name of a person).
 
 ## Examples
 
diff --git a/rules/aip0122/name_suffix.go b/rules/aip0122/name_suffix.go
index 37ac620..6f8b135 100644
--- a/rules/aip0122/name_suffix.go
+++ b/rules/aip0122/name_suffix.go
@@ -26,7 +26,12 @@ import (
 var nameSuffix = &lint.FieldRule{
 	Name: lint.NewRuleName(122, "name-suffix"),
 	OnlyIf: func(f *desc.FieldDescriptor) bool {
-		return !stringset.New("name", "display_name").Contains(f.GetName())
+		return !stringset.New(
+			"display_name",
+			"family_name",
+			"given_name",
+			"name",
+		).Contains(f.GetName())
 	},
 	LintField: func(f *desc.FieldDescriptor) []lint.Problem {
 		if n := f.GetName(); strings.HasSuffix(n, "_name") {


Test patch:
diff --git a/rules/aip0122/name_suffix_test.go b/rules/aip0122/name_suffix_test.go
index a1503a9..7ed8988 100644
--- a/rules/aip0122/name_suffix_test.go
+++ b/rules/aip0122/name_suffix_test.go
@@ -27,7 +27,9 @@ func TestNameSuffix(t *testing.T) {
 		problems  testutils.Problems
 	}{
 		{"Valid", "publisher", testutils.Problems{}},
-		{"ValidStandard", "display_name", testutils.Problems{}},
+		{"ValidStandardDisplay", "display_name", testutils.Problems{}},
+		{"ValidStandardGiven", "given_name", testutils.Problems{}},
+		{"ValidStandardFamily", "family_name", testutils.Problems{}},
 		{"Invalid", "author_name", testutils.Problems{{Suggestion: "author"}}},
 	} {
 		f := testutils.ParseProto3Tmpl(t, `
Repository: googleapis/api-linter
Pull request #537 (2020-05-11 18:51:20)

Fix php_namespace linter suggestions with extra backslashes.
Suggested backslashes were being doubled by fmt.Sprintf escaping added by %q. Unit tests also verified data with %q, so the incorrect expected values were not readily apparent.


Patch:
diff --git a/rules/aip0191/php_namespace.go b/rules/aip0191/php_namespace.go
index a260ea0..b3f6cbb 100644
--- a/rules/aip0191/php_namespace.go
+++ b/rules/aip0191/php_namespace.go
@@ -47,10 +47,11 @@ var phpNamespace = &lint.FileRule{
 				return []lint.Problem{{
 					Message: "PHP namespaces use UpperCamelCase.",
 					Suggestion: fmt.Sprintf(
-						"option php_namespace = %q;",
+						"option php_namespace = %s;",
 						// Even though the string value is a single backslash, we want
 						// to suggest two backslashes, because that is what should be
-						// typed into the editor.
+						// typed into the editor. We use %s to avoid additional escaping
+						// of backslashes by Sprintf.
 						strings.ReplaceAll(want, `\`, `\\`),
 					),
 					Descriptor: f,


Test patch:
diff --git a/rules/aip0191/php_namespace_test.go b/rules/aip0191/php_namespace_test.go
index b3f71c6..7a224b0 100644
--- a/rules/aip0191/php_namespace_test.go
+++ b/rules/aip0191/php_namespace_test.go
@@ -31,13 +31,13 @@ func TestPhpNamespace(t *testing.T) {
 		{"ValidBeta", `Google\\Example\\V1beta1`, testutils.Problems{}},
 		{"InvalidBadChars", "Google:Example:V1", testutils.Problems{{Message: "Invalid characters"}}},
 		{"Invalid", `google\\example\\v1`, testutils.Problems{{
-			Suggestion: fmt.Sprintf("option php_namespace = %q;", `Google\\Example\\V1`),
+			Suggestion: fmt.Sprintf("option php_namespace = %s;", `Google\\Example\\V1`),
 		}}},
 		{"InvalidVersion", `Google\\Example\\v1`, testutils.Problems{{
-			Suggestion: fmt.Sprintf("option php_namespace = %q;", `Google\\Example\\V1`),
+			Suggestion: fmt.Sprintf("option php_namespace = %s;", `Google\\Example\\V1`),
 		}}},
 		{"InvalidBeta", `Google\\Example\\V1Beta1`, testutils.Problems{{
-			Suggestion: fmt.Sprintf("option php_namespace = %q;", `Google\\Example\\V1beta1`),
+			Suggestion: fmt.Sprintf("option php_namespace = %s;", `Google\\Example\\V1beta1`),
 		}}},
 	} {
 		t.Run(test.name, func(t *testing.T) {
Repository: googleapis/api-linter
Pull request #538 (2020-05-19 20:02:26)

[AIP-215] Exempt known prefixes from versioning expectation.


Patch:
diff --git a/rules/aip0215/versioned_packages.go b/rules/aip0215/versioned_packages.go
index ec91a00..458bc9b 100644
--- a/rules/aip0215/versioned_packages.go
+++ b/rules/aip0215/versioned_packages.go
@@ -15,7 +15,6 @@
 package aip0215
 
 import (
-	"fmt"
 	"regexp"
 	"strings"
 
@@ -27,16 +26,24 @@ import (
 var versionedPackages = &lint.FileRule{
 	Name: lint.NewRuleName(215, "versioned-packages"),
 	OnlyIf: func(f *desc.FileDescriptor) bool {
-		return f.GetPackage() != ""
-	},
-	LintFile: func(f *desc.FileDescriptor) []lint.Problem {
 		p := f.GetPackage()
-		for _, exception := range []string{"master", "type"} {
-			if strings.HasSuffix(p, fmt.Sprintf(".%s", exception)) {
-				return nil
+		if p == "" {
+			return false
+		}
+		for _, exemptSuffix := range []string{".master", ".type"} {
+			if strings.HasSuffix(p, exemptSuffix) {
+				return false
 			}
 		}
-		if !version.MatchString(p) {
+		for _, exemptPrefix := range []string{"google.api.", "google.rpc.", "google.longrunning."} {
+			if strings.HasPrefix(p, exemptPrefix) {
+				return false
+			}
+		}
+		return true
+	},
+	LintFile: func(f *desc.FileDescriptor) []lint.Problem {
+		if !version.MatchString(f.GetPackage()) {
 			return []lint.Problem{{
 				Message:    "API components should be in versioned packages.",
 				Descriptor: f,


Test patch:
diff --git a/rules/aip0215/versioned_packages_test.go b/rules/aip0215/versioned_packages_test.go
index 429b57d..264a7e8 100644
--- a/rules/aip0215/versioned_packages_test.go
+++ b/rules/aip0215/versioned_packages_test.go
@@ -46,6 +46,9 @@ func TestVersionedPackages(t *testing.T) {
 		{"Master", "package foo.bar.master;", testutils.Problems{}},
 		{"InvalidNoVersion", "package foo.bar;", testutils.Problems{{Message: "versioned packages"}}},
 		{"InvalidSubpackage", "package foo.bar.v1.resources;", testutils.Problems{{Message: "versioned packages"}}},
+		{"IgnoredRPC", "package google.rpc.foobar;", testutils.Problems{}},
+		{"IgnoredLRO", "package google.longrunning.foobar;", testutils.Problems{}},
+		{"IgnoredAPI", "package google.api.foobar;", testutils.Problems{}},
 		{"IgnoredNoPackage", "", testutils.Problems{}},
 	} {
 		t.Run(test.name, func(t *testing.T) {
Repository: googleapis/api-linter
Pull request #551 (2020-06-02 23:20:29)

[AIP-132] Do not require method signatures if there is no parent.


Patch:
diff --git a/rules/aip0132/method_signature.go b/rules/aip0132/method_signature.go
index 709329b..db4ee2d 100644
--- a/rules/aip0132/method_signature.go
+++ b/rules/aip0132/method_signature.go
@@ -25,8 +25,10 @@ import (
 )
 
 var methodSignature = &lint.MethodRule{
-	Name:   lint.NewRuleName(132, "method-signature"),
-	OnlyIf: isListMethod,
+	Name: lint.NewRuleName(132, "method-signature"),
+	OnlyIf: func(m *desc.MethodDescriptor) bool {
+		return isListMethod(m) && m.GetInputType().FindFieldByName("parent") != nil
+	},
 	LintMethod: func(m *desc.MethodDescriptor) []lint.Problem {
 		signatures := utils.GetMethodSignatures(m)
 


Test patch:
diff --git a/rules/aip0132/method_signature_test.go b/rules/aip0132/method_signature_test.go
index a2e84e8..aa2f567 100644
--- a/rules/aip0132/method_signature_test.go
+++ b/rules/aip0132/method_signature_test.go
@@ -45,7 +45,9 @@ func TestMethodSignature(t *testing.T) {
 						{{.Signature}}
 					}
 				}
-				message {{.MethodName}}Request {}
+				message {{.MethodName}}Request {
+					string parent = 1;
+				}
 				message Book {}
 			`, test)
 			m := f.GetServices()[0].GetMethods()[0]
@@ -54,4 +56,19 @@ func TestMethodSignature(t *testing.T) {
 			}
 		})
 	}
+
+	// Run a special test for a missing parent.
+	t.Run("MissingParent", func(t *testing.T) {
+		f := testutils.ParseProto3String(t, `
+			import "google/api/client.proto";
+			service Library {
+				rpc ListBooks(ListBooksRequest) returns (Book);
+			}
+			message ListBooksRequest {}
+			message Book {}
+		`)
+		if diff := (testutils.Problems{}).Diff(methodSignature.Lint(f)); diff != "" {
+			t.Errorf(diff)
+		}
+	})
 }
Repository: googleapis/api-linter
Pull request #552 (2020-06-02 23:37:03)

[AIP-143] Region code, not country code.


Patch:
diff --git a/rules/aip0143/standardized_codes.go b/rules/aip0143/standardized_codes.go
index a38bb66..a13fdf6 100644
--- a/rules/aip0143/standardized_codes.go
+++ b/rules/aip0143/standardized_codes.go
@@ -27,7 +27,8 @@ var fieldNames = &lint.FieldRule{
 	LintField: func(f *desc.FieldDescriptor) []lint.Problem {
 		variants := map[string]string{
 			"content_type": "mime_type",
-			"country":      "country_code",
+			"country":      "region_code",
+			"country_code": "region_code",
 			"currency":     "currency_code",
 			"lang":         "language_code",
 			"language":     "language_code",


Test patch:
diff --git a/rules/aip0143/standardized_codes_test.go b/rules/aip0143/standardized_codes_test.go
index a22ab5b..ff42909 100644
--- a/rules/aip0143/standardized_codes_test.go
+++ b/rules/aip0143/standardized_codes_test.go
@@ -27,6 +27,9 @@ func TestFieldNames(t *testing.T) {
 	}{
 		{"something_random", testutils.Problems{}},
 		{"content_type", testutils.Problems{{Suggestion: "mime_type"}}},
+		{"country", testutils.Problems{{Suggestion: "region_code"}}},
+		{"country_code", testutils.Problems{{Suggestion: "region_code"}}},
+		{"region_code", testutils.Problems{}},
 		{"currency", testutils.Problems{{Suggestion: "currency_code"}}},
 		{"currency_code", testutils.Problems{}},
 		{"language", testutils.Problems{{Suggestion: "language_code"}}},
Repository: googleapis/api-linter
Pull request #558 (2020-06-15 17:18:14)

[AIP-215] Permit .vXmaster versions.


Patch:
diff --git a/rules/aip0215/versioned_packages.go b/rules/aip0215/versioned_packages.go
index b13be72..162e0c4 100644
--- a/rules/aip0215/versioned_packages.go
+++ b/rules/aip0215/versioned_packages.go
@@ -27,18 +27,23 @@ import (
 var versionedPackages = &lint.FileRule{
 	Name: lint.NewRuleName(215, "versioned-packages"),
 	OnlyIf: func(f *desc.FileDescriptor) bool {
+		// Common protos are exempt.
 		if utils.IsCommonProto(f) {
 			return false
 		}
-		p := f.GetPackage()
-		if p == "" {
+
+		// Ignore this if there is no package.
+		p := strings.Split(f.GetPackage(), ".")
+		if len(p) == 1 && p[0] == "" {
 			return false
 		}
-		for _, exemptSuffix := range []string{".master", ".type"} {
-			if strings.HasSuffix(p, exemptSuffix) {
-				return false
-			}
+
+		// Exempt anything ending in .type, or .v1master, .v2master, .master, etc.
+		if last := p[len(p)-1]; last == "type" || strings.HasSuffix(last, "master") {
+			return false
 		}
+
+		// Everything else should follow the rule.
 		return true
 	},
 	LintFile: func(f *desc.FileDescriptor) []lint.Problem {


Test patch:
diff --git a/rules/aip0215/versioned_packages_test.go b/rules/aip0215/versioned_packages_test.go
index 264a7e8..96c3620 100644
--- a/rules/aip0215/versioned_packages_test.go
+++ b/rules/aip0215/versioned_packages_test.go
@@ -44,6 +44,7 @@ func TestVersionedPackages(t *testing.T) {
 		{"Test1", "package foo.bar.v1test1;", testutils.Problems{}},
 		{"Type", "package foo.bar.type;", testutils.Problems{}},
 		{"Master", "package foo.bar.master;", testutils.Problems{}},
+		{"VXMaster", "package foo.bar.v3master;", testutils.Problems{}},
 		{"InvalidNoVersion", "package foo.bar;", testutils.Problems{{Message: "versioned packages"}}},
 		{"InvalidSubpackage", "package foo.bar.v1.resources;", testutils.Problems{{Message: "versioned packages"}}},
 		{"IgnoredRPC", "package google.rpc.foobar;", testutils.Problems{}},
Repository: googleapis/api-linter
Pull request #563 (2020-06-16 18:37:26)

[AIP-134] Do not warn on SetIamPolicy.


Patch:
diff --git a/rules/aip0134/synonyms.go b/rules/aip0134/synonyms.go
index 888e865..3b4a422 100644
--- a/rules/aip0134/synonyms.go
+++ b/rules/aip0134/synonyms.go
@@ -26,6 +26,9 @@ import (
 // Update methods should use the word "update", not synonyms.
 var synonyms = &lint.MethodRule{
 	Name: lint.NewRuleName(134, "synonyms"),
+	OnlyIf: func(m *desc.MethodDescriptor) bool {
+		return m.GetName() != "SetIamPolicy"
+	},
 	LintMethod: func(m *desc.MethodDescriptor) []lint.Problem {
 		name := m.GetName()
 		for _, syn := range []string{"Patch", "Put", "Set"} {


Test patch:
diff --git a/rules/aip0134/synonyms_test.go b/rules/aip0134/synonyms_test.go
index b860529..115561f 100644
--- a/rules/aip0134/synonyms_test.go
+++ b/rules/aip0134/synonyms_test.go
@@ -29,6 +29,7 @@ func TestSynonyms(t *testing.T) {
 		{"PatchBook", testutils.Problems{{Suggestion: "UpdateBook"}}},
 		{"PutBook", testutils.Problems{{Suggestion: "UpdateBook"}}},
 		{"SetBook", testutils.Problems{{Suggestion: "UpdateBook"}}},
+		{"SetIamPolicy", nil},
 	}
 	for _, test := range tests {
 		t.Run(test.MethodName, func(t *testing.T) {
Repository: googleapis/api-linter
Pull request #569 (2020-06-19 17:43:38)

Fix snake_case for plural resource name
plural is not currently converted to snake_case, but is used in comparison on line 46


Patch:
diff --git a/rules/aip0136/http_parent_variable.go b/rules/aip0136/http_parent_variable.go
index 993a7c9..b15e0c7 100644
--- a/rules/aip0136/http_parent_variable.go
+++ b/rules/aip0136/http_parent_variable.go
@@ -37,8 +37,8 @@ var httpParentVariable = &lint.MethodRule{
 			if _, ok := vars["parent"]; ok {
 				// Determine the resource.
 				segs := strings.Split(strings.Split(http.GetPlainURI(), ":")[0], "/")
-				plural := segs[len(segs)-1]
-				singular := strcase.SnakeCase(p.Singular(plural))
+				plural := strcase.SnakeCase(segs[len(segs)-1])
+				singular := p.Singular(plural)
 
 				// Does the RPC name end in the singular or plural name of the resource?
 				// If not, complain.


Test patch:
diff --git a/rules/aip0136/http_parent_variable_test.go b/rules/aip0136/http_parent_variable_test.go
index 691904a..59c6955 100644
--- a/rules/aip0136/http_parent_variable_test.go
+++ b/rules/aip0136/http_parent_variable_test.go
@@ -34,6 +34,7 @@ func TestHTTPParentVariable(t *testing.T) {
 		{"ValidBookVar", "WritePage", "/v1/{book=publishers/*/books/*}:writePage", testutils.Problems{}},
 		{"ValidBatchGet", "BatchGetBooks", "/v1/{parent=publishers/*}/books:batchGet", testutils.Problems{}},
 		{"ValidBatchCreate", "BatchCreateBooks", "/v1/{parent=publishers/*}/books:batchCreate", testutils.Problems{}},
+		{"ValidTwoWordNounBatch", "BatchUpdateAudioBooks", "/v1/{parent=publishers/*}/audioBooks:batchUpdate", testutils.Problems{}},
 	} {
 		t.Run(test.name, func(t *testing.T) {
 			f := testutils.ParseProto3Tmpl(t, `