Skip to content

Commit

Permalink
fix: trim -plugin suffix from artifactId
Browse files Browse the repository at this point in the history
Avoids doubling up -plugin-plugin-developers team name

Ref: #19
  • Loading branch information
sghill committed Aug 23, 2023
1 parent 21932f3 commit d89dfcb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ArtifactIdTeamNameGenerator implements TeamNameGenerator<TeamNameInput> {
public String generate(TeamNameInput input) {
String artifactId = input.getArtifactId();
String withoutParent = artifactId;
if (artifactId.endsWith("-parent")) {
if (artifactId.endsWith("-parent") || artifactId.endsWith("-plugin")) {
withoutParent = artifactId.substring(0, artifactId.lastIndexOf('-'));
}
return ("@jenkinsci/" + (withoutParent + "-plugin-developers")).toLowerCase(Locale.ROOT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class ArtifactIdTeamNameGeneratorTest {
"stashNotifier,@jenkinsci/stashnotifier-plugin-developers",
"aws-java-sdk-parent,@jenkinsci/aws-java-sdk-plugin-developers",
"warnings-ng-parent,@jenkinsci/warnings-ng-plugin-developers",
"build-user-vars-plugin,@jenkinsci/build-user-vars-plugin-developers",
"project-stats-plugin,@jenkinsci/project-stats-plugin-developers",
"plugin-usage-plugin,@jenkinsci/plugin-usage-plugin-developers",
"build-keeper-plugin,@jenkinsci/build-keeper-plugin-developers",
})
void shouldGenerateExpectedTeamName(String artifactId, String expected) {
String actual = generator.generate(new TeamNameInput(artifactId));
Expand Down

0 comments on commit d89dfcb

Please sign in to comment.