Reformat code with google-java-format Change-Id: I6f1445ac7e9599c17d8ad120a1816035deda3732
diff --git a/java/com/google/gerrit/plugins/codeowners/acceptance/testsuite/TestCodeOwnerConfigCreation.java b/java/com/google/gerrit/plugins/codeowners/acceptance/testsuite/TestCodeOwnerConfigCreation.java index e43288e..a445b1f 100644 --- a/java/com/google/gerrit/plugins/codeowners/acceptance/testsuite/TestCodeOwnerConfigCreation.java +++ b/java/com/google/gerrit/plugins/codeowners/acceptance/testsuite/TestCodeOwnerConfigCreation.java
@@ -140,7 +140,8 @@ .orElseThrow( () -> new IllegalStateException( - "project not specified, specifying a project is required for code owner config creation")); + "project not specified, specifying a project is required for code owner" + + " config creation")); String branchName = branch().orElse("master"); Path folderPath = folderPath().orElse(Path.of("/")); return CodeOwnerConfig.Key.create(
diff --git a/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerSetModification.java b/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerSetModification.java index 8964008..f246cbb 100644 --- a/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerSetModification.java +++ b/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerSetModification.java
@@ -196,8 +196,7 @@ return codeOwnerSet; } - return codeOwnerSet - .toBuilder() + return codeOwnerSet.toBuilder() .setCodeOwners( Sets.difference(codeOwnerSet.codeOwners(), ImmutableSet.of(codeOwnerReference)) .immutableCopy())
diff --git a/java/com/google/gerrit/plugins/codeowners/backend/PathCodeOwnersResult.java b/java/com/google/gerrit/plugins/codeowners/backend/PathCodeOwnersResult.java index b0ab171..e5e9e34 100644 --- a/java/com/google/gerrit/plugins/codeowners/backend/PathCodeOwnersResult.java +++ b/java/com/google/gerrit/plugins/codeowners/backend/PathCodeOwnersResult.java
@@ -186,8 +186,8 @@ addMessage( DebugMessage.createMessage( String.format( - "found matching per-file code owner set (with path expressions = %s) that ignores" - + " parent code owners, hence ignoring the folder code owners", + "found matching per-file code owner set (with path expressions = %s) that" + + " ignores parent code owners, hence ignoring the folder code owners", perFileCodeOwnerSet.pathExpressions()))); } }
diff --git a/java/com/google/gerrit/plugins/codeowners/backend/config/AbstractRequiredApprovalConfig.java b/java/com/google/gerrit/plugins/codeowners/backend/config/AbstractRequiredApprovalConfig.java index f5ce964..06d0bc2 100644 --- a/java/com/google/gerrit/plugins/codeowners/backend/config/AbstractRequiredApprovalConfig.java +++ b/java/com/google/gerrit/plugins/codeowners/backend/config/AbstractRequiredApprovalConfig.java
@@ -122,7 +122,8 @@ validationMessages.add( new CommitValidationMessage( String.format( - "Required approval '%s' that is configured in %s (parameter %s.%s) is invalid: %s", + "Required approval '%s' that is configured in %s (parameter %s.%s) is invalid:" + + " %s", requiredApproval, fileName, SECTION_CODE_OWNERS,
diff --git a/java/com/google/gerrit/plugins/codeowners/backend/config/BackendConfig.java b/java/com/google/gerrit/plugins/codeowners/backend/config/BackendConfig.java index 2077d64..c4cd90e 100644 --- a/java/com/google/gerrit/plugins/codeowners/backend/config/BackendConfig.java +++ b/java/com/google/gerrit/plugins/codeowners/backend/config/BackendConfig.java
@@ -141,7 +141,8 @@ validationMessages.add( new CommitValidationMessage( String.format( - "Code owner backend '%s' that is configured in %s (parameter %s.%s.%s) not found.", + "Code owner backend '%s' that is configured in %s (parameter %s.%s.%s) not" + + " found.", backendName, fileName, SECTION_CODE_OWNERS, subsection, KEY_BACKEND), ValidationMessage.Type.ERROR)); } @@ -154,7 +155,8 @@ validationMessages.add( new CommitValidationMessage( String.format( - "Path expressions '%s' that are configured in %s (parameter %s.%s.%s) not found.", + "Path expressions '%s' that are configured in %s (parameter %s.%s.%s) not" + + " found.", pathExpressionsName, fileName, SECTION_CODE_OWNERS,
diff --git a/java/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginConfig.java b/java/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginConfig.java index 7bd0971..f15a076 100644 --- a/java/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginConfig.java +++ b/java/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginConfig.java
@@ -152,9 +152,9 @@ for (String name : config.getNames(section)) { configWithBase.setStringList( section, - /* subsection = */ null, + /* subsection= */ null, name, - Arrays.asList(config.getStringList(section, /* subsection = */ null, name))); + Arrays.asList(config.getStringList(section, /* subsection= */ null, name))); } for (String subsection : config.getSubsections(section)) {
diff --git a/java/com/google/gerrit/plugins/codeowners/backend/config/GeneralConfig.java b/java/com/google/gerrit/plugins/codeowners/backend/config/GeneralConfig.java index ada9105..bc232b2 100644 --- a/java/com/google/gerrit/plugins/codeowners/backend/config/GeneralConfig.java +++ b/java/com/google/gerrit/plugins/codeowners/backend/config/GeneralConfig.java
@@ -128,7 +128,8 @@ validationMessages.add( new CommitValidationMessage( String.format( - "Merge commit strategy '%s' that is configured in %s (parameter %s.%s) is invalid.", + "Merge commit strategy '%s' that is configured in %s (parameter %s.%s) is" + + " invalid.", projectLevelConfig.getString( SECTION_CODE_OWNERS, /* subsection= */ null, KEY_MERGE_COMMIT_STRATEGY), fileName, @@ -147,7 +148,8 @@ validationMessages.add( new CommitValidationMessage( String.format( - "The value for fallback code owners '%s' that is configured in %s (parameter %s.%s) is invalid.", + "The value for fallback code owners '%s' that is configured in %s (parameter" + + " %s.%s) is invalid.", projectLevelConfig.getString( SECTION_CODE_OWNERS, /* subsection= */ null, KEY_FALLBACK_CODE_OWNERS), fileName, @@ -838,8 +840,8 @@ KEY_MERGE_COMMIT_STRATEGY, MergeCommitStrategy.ALL_CHANGED_FILES); } catch (IllegalArgumentException e) { logger.atWarning().withCause(e).log( - "Ignoring invalid value %s for merge commit stategy in gerrit.config (parameter plugin.%s.%s)." - + " Falling back to default value %s.", + "Ignoring invalid value %s for merge commit stategy in gerrit.config (parameter" + + " plugin.%s.%s). Falling back to default value %s.", pluginConfigFromGerritConfig.getString(KEY_MERGE_COMMIT_STRATEGY), pluginName, KEY_MERGE_COMMIT_STRATEGY,
diff --git a/java/com/google/gerrit/plugins/codeowners/restapi/AbstractGetCodeOwnersForPath.java b/java/com/google/gerrit/plugins/codeowners/restapi/AbstractGetCodeOwnersForPath.java index dba335b..9c293db 100644 --- a/java/com/google/gerrit/plugins/codeowners/restapi/AbstractGetCodeOwnersForPath.java +++ b/java/com/google/gerrit/plugins/codeowners/restapi/AbstractGetCodeOwnersForPath.java
@@ -619,8 +619,7 @@ */ private Stream<Account.Id> getRandomUsers(int limit) throws IOException { return accounts - .randomNIds( - limit, seed.isPresent() ? seed.get() : ThreadLocalRandom.current().nextLong()) + .randomNIds(limit, seed.isPresent() ? seed.get() : ThreadLocalRandom.current().nextLong()) .stream(); } }
diff --git a/java/com/google/gerrit/plugins/codeowners/restapi/CheckCodeOwner.java b/java/com/google/gerrit/plugins/codeowners/restapi/CheckCodeOwner.java index 2eb6f92..ac4d29a 100644 --- a/java/com/google/gerrit/plugins/codeowners/restapi/CheckCodeOwner.java +++ b/java/com/google/gerrit/plugins/codeowners/restapi/CheckCodeOwner.java
@@ -158,8 +158,12 @@ @Override public Response<CodeOwnerCheckInfo> apply(BranchResource branchResource) - throws BadRequestException, AuthException, IOException, ConfigInvalidException, - PermissionBackendException, ResourceNotFoundException { + throws BadRequestException, + AuthException, + IOException, + ConfigInvalidException, + PermissionBackendException, + ResourceNotFoundException { if (!self.get().isIdentifiedUser()) { throw new AuthException("Authentication required"); } @@ -257,8 +261,8 @@ messages.add( DebugMessage.createMessage( String.format( - "found the all users wildcard ('%s') as a code owner in %s which makes %s a" - + " code owner", + "found the all users wildcard ('%s') as a code owner in %s which makes %s" + + " a code owner", CodeOwnerResolver.ALL_USERS_WILDCARD, codeOwnerConfigFilePath, email))); } @@ -268,7 +272,8 @@ messages.add( DebugMessage.createMessage( String.format( - "found annotations for the all users wildcard ('%s') which apply to %s: %s", + "found annotations for the all users wildcard ('%s') which apply to %s:" + + " %s", CodeOwnerResolver.ALL_USERS_WILDCARD, email, sort(localAnnotations)))); annotations.addAll(localAnnotations); } @@ -399,8 +404,12 @@ } private void validateInput(BranchResource branchResource) - throws BadRequestException, AuthException, IOException, ConfigInvalidException, - PermissionBackendException, ResourceNotFoundException { + throws BadRequestException, + AuthException, + IOException, + ConfigInvalidException, + PermissionBackendException, + ResourceNotFoundException { if (branchResource.getRevision().isEmpty()) { throw new ResourceNotFoundException(IdString.fromDecoded(branchResource.getName())); } @@ -449,7 +458,9 @@ } private boolean isGlobalCodeOwner(Project.NameKey projectName, String email) { - return codeOwnersPluginConfiguration.getProjectConfig(projectName).getGlobalCodeOwners() + return codeOwnersPluginConfiguration + .getProjectConfig(projectName) + .getGlobalCodeOwners() .stream() .filter(cor -> cor.email().equals(email)) .findAny()
diff --git a/java/com/google/gerrit/plugins/codeowners/restapi/GetCodeOwnerStatus.java b/java/com/google/gerrit/plugins/codeowners/restapi/GetCodeOwnerStatus.java index c1984e6..58fdc83 100644 --- a/java/com/google/gerrit/plugins/codeowners/restapi/GetCodeOwnerStatus.java +++ b/java/com/google/gerrit/plugins/codeowners/restapi/GetCodeOwnerStatus.java
@@ -89,8 +89,11 @@ @Override public Response<CodeOwnerStatusInfo> apply(ChangeResource changeResource) - throws RestApiException, IOException, PermissionBackendException, - PatchListNotAvailableException, DiffNotAvailableException { + throws RestApiException, + IOException, + PermissionBackendException, + PatchListNotAvailableException, + DiffNotAvailableException { validateStartAndLimit(); ImmutableSet<FileCodeOwnerStatus> fileCodeOwnerStatuses =
diff --git a/java/com/google/gerrit/plugins/codeowners/restapi/GetCodeOwnersForPathInBranch.java b/java/com/google/gerrit/plugins/codeowners/restapi/GetCodeOwnersForPathInBranch.java index 85410e9..691d564 100644 --- a/java/com/google/gerrit/plugins/codeowners/restapi/GetCodeOwnersForPathInBranch.java +++ b/java/com/google/gerrit/plugins/codeowners/restapi/GetCodeOwnersForPathInBranch.java
@@ -64,8 +64,8 @@ name = "-revision", usage = "revision from which the code owner configs in the branch should be read (imports from" - + " other branches or repositories as well as global code owners from refs/meta/config" - + " are still read from the current revisions)") + + " other branches or repositories as well as global code owners from" + + " refs/meta/config are still read from the current revisions)") public void setRevision(String revision) { this.revision = revision; }
diff --git a/java/com/google/gerrit/plugins/codeowners/restapi/GetOwnedPaths.java b/java/com/google/gerrit/plugins/codeowners/restapi/GetOwnedPaths.java index bab4ac7..3dce577 100644 --- a/java/com/google/gerrit/plugins/codeowners/restapi/GetOwnedPaths.java +++ b/java/com/google/gerrit/plugins/codeowners/restapi/GetOwnedPaths.java
@@ -94,8 +94,11 @@ @Override public Response<OwnedPathsInfo> apply(RevisionResource revisionResource) - throws BadRequestException, ResourceConflictException, UnresolvableAccountException, - ConfigInvalidException, IOException { + throws BadRequestException, + ResourceConflictException, + UnresolvableAccountException, + ConfigInvalidException, + IOException { validateStartAndLimit(); Account.Id accountId = resolveAccount(); @@ -120,7 +123,9 @@ } private Account.Id resolveAccount() - throws BadRequestException, UnresolvableAccountException, ConfigInvalidException, + throws BadRequestException, + UnresolvableAccountException, + ConfigInvalidException, IOException { if (Strings.isNullOrEmpty(user)) { throw new BadRequestException("--user required");
diff --git a/java/com/google/gerrit/plugins/codeowners/restapi/RenameEmail.java b/java/com/google/gerrit/plugins/codeowners/restapi/RenameEmail.java index e338543..27b3b2d 100644 --- a/java/com/google/gerrit/plugins/codeowners/restapi/RenameEmail.java +++ b/java/com/google/gerrit/plugins/codeowners/restapi/RenameEmail.java
@@ -78,8 +78,12 @@ @Override public Response<RenameEmailResultInfo> apply( BranchResource branchResource, RenameEmailInput input) - throws AuthException, BadRequestException, ResourceConflictException, - MethodNotAllowedException, UnprocessableEntityException, PermissionBackendException, + throws AuthException, + BadRequestException, + ResourceConflictException, + MethodNotAllowedException, + UnprocessableEntityException, + PermissionBackendException, IOException { if (!currentUser.get().isIdentifiedUser()) { throw new AuthException("Authentication required");
diff --git a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerIT.java b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerIT.java index 0208bc9..cebab20 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerIT.java +++ b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerIT.java
@@ -175,7 +175,8 @@ assertThat(checkCodeOwnerInfo) .hasDebugLogsThatContainAllOf( String.format( - "cannot resolve code owner email %s: account %s is referenced by secondary email but user %s cannot see secondary emails", + "cannot resolve code owner email %s: account %s is referenced by secondary email" + + " but user %s cannot see secondary emails", secondaryEmail, codeOwner.id(), user.username())); requestScopeOperations.setApiUser(user.id());
diff --git a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/OnCodeOwnerOverrrideIT.java b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/OnCodeOwnerOverrrideIT.java index 61dff07..819917b 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/OnCodeOwnerOverrrideIT.java +++ b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/OnCodeOwnerOverrrideIT.java
@@ -76,7 +76,8 @@ .isEqualTo( String.format( "Patch Set 1: Owners-Override+1\n\n" - + "By voting Owners-Override+1 the code-owners submit requirement is overridden by %s\n", + + "By voting Owners-Override+1 the code-owners submit requirement is overridden" + + " by %s\n", AccountTemplateUtil.getAccountTemplate(admin.id()))); } @@ -113,7 +114,8 @@ .isEqualTo( String.format( "Patch Set 1: Owners-Override+1\n\n" - + "By voting Owners-Override+1 the code-owners submit requirement is overridden by %s\n", + + "By voting Owners-Override+1 the code-owners submit requirement is overridden" + + " by %s\n", AccountTemplateUtil.getAccountTemplate(admin.id()))); // Apply the Owners-Override+1 approval by another user @@ -125,7 +127,8 @@ .isEqualTo( String.format( "Patch Set 1: Owners-Override+1\n\n" - + "By voting Owners-Override+1 the code-owners submit requirement is overridden by %s\n", + + "By voting Owners-Override+1 the code-owners submit requirement is overridden" + + " by %s\n", AccountTemplateUtil.getAccountTemplate(user.id()))); } @@ -355,7 +358,8 @@ .isEqualTo( String.format( "Patch Set 1: Owners-Override+1\n\n" - + "By voting Owners-Override+1 the code-owners submit requirement is overridden by %s\n", + + "By voting Owners-Override+1 the code-owners submit requirement is overridden" + + " by %s\n", AccountTemplateUtil.getAccountTemplate(admin.id()))); } @@ -601,7 +605,8 @@ .isEqualTo( String.format( "Patch Set 1: Owners-Override+1\n\n" - + "By voting Owners-Override+1 the code-owners submit requirement is overridden by %s\n", + + "By voting Owners-Override+1 the code-owners submit requirement is overridden" + + " by %s\n", AccountTemplateUtil.getAccountTemplate(user.id()))); } @@ -667,7 +672,8 @@ .contains( String.format( "Patch Set 1: Owners-Override+1\n\n" - + "By voting Owners-Override+1 the code-owners submit requirement is overridden by %s <%s>\n", + + "By voting Owners-Override+1 the code-owners submit requirement is overridden" + + " by %s <%s>\n", user.fullName(), user.email())); } }
diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigFileTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigFileTest.java index e6b776d..6d11bfc 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigFileTest.java +++ b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerConfigFileTest.java
@@ -567,9 +567,7 @@ return CodeOwnerConfig.builder(codeOwnerConfigKey, revision).build(); } - return codeOwnerConfigCache - .get(codeOwnerConfigAsString) - .toBuilder() + return codeOwnerConfigCache.get(codeOwnerConfigAsString).toBuilder() .setRevision(revision) .build(); }
diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/config/AbstractRequiredApprovalConfigTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/config/AbstractRequiredApprovalConfigTest.java index a8b6f0b..b44c2fe 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/backend/config/AbstractRequiredApprovalConfigTest.java +++ b/javatests/com/google/gerrit/plugins/codeowners/backend/config/AbstractRequiredApprovalConfigTest.java
@@ -114,9 +114,9 @@ .hasMessageThat() .isEqualTo( String.format( - "Invalid configuration of the code-owners plugin. Required approval 'INVALID' that is" - + " configured in code-owners.config (parameter codeOwners.%s) is" - + " invalid: Invalid format, expected '<label-name>+<label-value>'.", + "Invalid configuration of the code-owners plugin. Required approval 'INVALID' that" + + " is configured in code-owners.config (parameter codeOwners.%s) is invalid:" + + " Invalid format, expected '<label-name>+<label-value>'.", getRequiredApprovalConfig().getConfigKey())); }
diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginConfigValidatorTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginConfigValidatorTest.java index 479ad1d..59f2d0e 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginConfigValidatorTest.java +++ b/javatests/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginConfigValidatorTest.java
@@ -94,7 +94,8 @@ .hasMessageThat() .isEqualTo( String.format( - "failed to validate file code-owners.config for revision %s in ref %s of project %s", + "failed to validate file code-owners.config for revision %s in ref %s of project" + + " %s", commit.getName(), RefNames.REFS_CONFIG, project)); assertThat(exception).hasCauseThat().isInstanceOf(ConfigInvalidException.class); }
diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginProjectConfigSnapshotTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginProjectConfigSnapshotTest.java index 15b51d7..b185c11 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginProjectConfigSnapshotTest.java +++ b/javatests/com/google/gerrit/plugins/codeowners/backend/config/CodeOwnersPluginProjectConfigSnapshotTest.java
@@ -1222,8 +1222,8 @@ String.format( "Invalid configuration of the code-owners plugin. Required approval 'Foo-Bar+1'" + " that is configured in gerrit.config (parameter" - + " plugin.code-owners.requiredApproval) is invalid: Label Foo-Bar doesn't exist" - + " for project %s.", + + " plugin.code-owners.requiredApproval) is invalid: Label Foo-Bar doesn't" + + " exist for project %s.", project.get())); }
diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/proto/ProtoCodeOwnerConfigParserTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/proto/ProtoCodeOwnerConfigParserTest.java index 5d0d20c..6e4f9e5 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/backend/proto/ProtoCodeOwnerConfigParserTest.java +++ b/javatests/com/google/gerrit/plugins/codeowners/backend/proto/ProtoCodeOwnerConfigParserTest.java
@@ -90,7 +90,8 @@ "owners_config {\n owner_sets {\nINVALID_LINE\n }\n}\n")); assertThat(exception.getFullMessage(ProtoBackend.CODE_OWNER_CONFIG_FILE_NAME)) .isEqualTo( - "invalid code owner config file '/OWNERS_METADATA' (project = project, branch = master):\n" + "invalid code owner config file '/OWNERS_METADATA' (project = project, branch =" + + " master):\n" + " 4:3: Expected \"{\"."); } @@ -98,7 +99,13 @@ public void codeOwnerConfigWithInlineComments() throws Exception { assertParseAndFormat( String.format( - "owners_config {\n owner_sets {\n owners {\n email: \"%s\" # comment\n }\n }\n}\n", + "owners_config {\n" + + " owner_sets {\n" + + " owners {\n" + + " email: \"%s\" # comment\n" + + " }\n" + + " }\n" + + "}\n", EMAIL_1), codeOwnerConfig -> assertThat(codeOwnerConfig)