Skip to content

Commit 681a756

Browse files
authored
[#2447] Add support for multiple git author names (#2460)
Add support for multiple author names. This is similar to how the parser handles authors emails.
1 parent f32bcb6 commit 681a756

File tree

10 files changed

+24
-20
lines changed

10 files changed

+24
-20
lines changed

docs/ug/reportConfig.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ repos:
3636
authors:
3737
- author-git-host-id: Your username on GitHub, GitLab or Bitbucket
3838
author-display-name: Your display name
39-
author-git-author-name: Author Name Of Your Git Configuration
39+
author-git-author-name:
40+
- Author Name Of Your Git Configuration
4041
author-emails:
4142
4243

src/main/java/reposense/model/OneStopConfigRunConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public List<RepoConfiguration> getRepoConfigurations() throws InvalidLocationExc
5959
Author author = new Author(rad.getAuthorGitHostId());
6060
author.setEmails(rad.getAuthorEmails());
6161
author.setDisplayName(rad.getAuthorDisplayName());
62-
author.setAuthorAliases(List.of(rad.getAuthorGitAuthorName()));
62+
author.setAuthorAliases(rad.getAuthorGitAuthorNames());
6363

6464
authorConfiguration.addAuthor(author);
6565
}

src/main/java/reposense/model/reportconfig/ReportAuthorDetails.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ public class ReportAuthorDetails {
1313
private final List<String> authorEmails;
1414
private final String authorGitHostId;
1515
private final String authorDisplayName;
16-
private final String authorGitAuthorName;
16+
private final List<String> authorGitAuthorNames;
1717

1818
@JsonCreator
1919
public ReportAuthorDetails(
2020
@JsonProperty("author-emails") List<String> authorEmails,
2121
@JsonProperty("author-git-host-id") String authorGitHostId,
2222
@JsonProperty("author-display-name") String authorDisplayName,
23-
@JsonProperty("author-git-author-name") String authorGitAuthorName) {
23+
@JsonProperty("author-git-author-name") List<String> authorGitAuthorNames) {
2424
if (authorGitHostId == null) {
2525
throw new IllegalArgumentException("Author Git Host ID cannot be empty.");
2626
}
2727
this.authorGitHostId = authorGitHostId;
2828
this.authorEmails = authorEmails == null ? new ArrayList<>() : authorEmails;
2929
this.authorDisplayName = authorDisplayName == null ? "" : authorDisplayName;
30-
this.authorGitAuthorName = authorGitAuthorName == null ? "" : authorGitAuthorName;
30+
this.authorGitAuthorNames = authorGitAuthorNames == null ? new ArrayList<>() : authorGitAuthorNames;
3131
}
3232

3333
public List<String> getAuthorEmails() {
@@ -42,8 +42,8 @@ public String getAuthorDisplayName() {
4242
return authorDisplayName;
4343
}
4444

45-
public String getAuthorGitAuthorName() {
46-
return authorGitAuthorName;
45+
public List<String> getAuthorGitAuthorNames() {
46+
return authorGitAuthorNames;
4747
}
4848

4949
@Override
@@ -57,7 +57,7 @@ public boolean equals(Object obj) {
5757
return rad.getAuthorEmails().equals(this.getAuthorEmails())
5858
&& rad.getAuthorGitHostId().equals(this.getAuthorGitHostId())
5959
&& rad.getAuthorDisplayName().equals(this.getAuthorDisplayName())
60-
&& rad.getAuthorGitAuthorName().equals(this.getAuthorGitAuthorName());
60+
&& rad.getAuthorGitAuthorNames().equals(this.getAuthorGitAuthorNames());
6161
}
6262

6363
return false;

src/systemtest/resources/ReportConfigSystemTest/report-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ repos:
1919
authors:
2020
- author-git-host-id: jedkohjk
2121
author-display-name: jedkohjk
22-
author-git-author-name: jedkohjk
22+
author-git-author-name:
23+
- jedkohjk
2324
author-emails:
2425
ignore-authors-list:
2526
ignore-glob-list:

src/test/java/reposense/model/OneStopConfigRunConfigurationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static void setUpActualRepoConfigurations() {
2626

2727
List<String> emailList = List.of("[email protected]");
2828
ReportAuthorDetails author = new ReportAuthorDetails(emailList, "FH-30",
29-
"Francis Hodianto", "Francis Hodianto");
29+
"Francis Hodianto", List.of("Francis Hodianto"));
3030

3131
List<ReportAuthorDetails> authorList = List.of(author);
3232
List<String> ignoreGlobList = List.of("**.md");

src/test/java/reposense/model/reportconfig/ReportAuthorDetailsTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class ReportAuthorDetailsTest {
1010
List.of("[email protected]"),
1111
"gitHostId",
1212
"Display Name",
13-
"Git Author"
13+
List.of("Git Author")
1414
);
1515

1616
@Test
@@ -20,13 +20,13 @@ public void constructor_withValidInputs_success() {
2020
emails,
2121
"Git Host Id",
2222
"Display Name",
23-
"Git Author"
23+
List.of("Git Author")
2424
);
2525

2626
Assertions.assertEquals(emails, details.getAuthorEmails());
2727
Assertions.assertEquals("Git Host Id", details.getAuthorGitHostId());
2828
Assertions.assertEquals("Display Name", details.getAuthorDisplayName());
29-
Assertions.assertEquals("Git Author", details.getAuthorGitAuthorName());
29+
Assertions.assertEquals("Git Author", details.getAuthorGitAuthorNames().get(0));
3030
}
3131

3232
@Test
@@ -36,7 +36,7 @@ public void constructor_nullGitHostId_throwsIllegalArgumentException() {
3636
List.of("[email protected]"),
3737
null,
3838
"Display Name",
39-
"Git Author"
39+
List.of("Git Author")
4040
);
4141
});
4242
}
@@ -52,7 +52,7 @@ public void equals_equivalentObject_success() {
5252
List.of("[email protected]"),
5353
"gitHostId",
5454
"Display Name",
55-
"Git Author"
55+
List.of("Git Author")
5656
);
5757

5858
Assertions.assertEquals(details1, details2);
@@ -64,7 +64,7 @@ public void equals_differentObject_failure() {
6464
List.of("[email protected]"),
6565
"gitHostId",
6666
"Display Name",
67-
"Git Author"
67+
List.of("Git Author")
6868
);
6969

7070
Assertions.assertNotEquals(details1, details2);

src/test/java/reposense/model/reportconfig/ReportConfigurationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static void setUp() {
2121

2222
List<String> emailList = List.of("[email protected]");
2323
ReportAuthorDetails author = new ReportAuthorDetails(emailList, "FH-30",
24-
"Francis Hodianto", "Francis Hodianto");
24+
"Francis Hodianto", List.of("Francis Hodianto"));
2525

2626
List<ReportAuthorDetails> authorList = List.of(author);
2727
List<String> ignoreGlobList = List.of("**.md");

src/test/java/reposense/parser/ReportConfigYamlParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static void setUp() {
3737
List<String> emailList = new ArrayList<>();
3838
emailList.add("[email protected]");
3939
ReportAuthorDetails author = new ReportAuthorDetails(emailList, "FH-30",
40-
"Francis Hodianto", "Francis Hodianto");
40+
"Francis Hodianto", List.of("Francis Hodianto"));
4141

4242
List<ReportAuthorDetails> authorList = new ArrayList<>();
4343
authorList.add(author);

src/test/resources/ReportConfigYamlParserTest/report-config-valid.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ repos:
1111
authors:
1212
- author-git-host-id: FH-30
1313
author-display-name: Francis Hodianto
14-
author-git-author-name: Francis Hodianto
14+
author-git-author-name:
15+
- Francis Hodianto
1516
author-emails:
1617
1718
ignore-authors-list:

src/test/resources/RunConfigurationDeciderTest/both-configs/report-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ repos:
1919
authors:
2020
- author-git-host-id: jedkohjk
2121
author-display-name: jedkohjk
22-
author-git-author-name: jedkohjk
22+
author-git-author-name:
23+
- jedkohjk
2324
author-emails:
2425
ignore-authors-list:
2526
- bot

0 commit comments

Comments
 (0)