Skip to content

[#2524] Add new --author-dedup-mode flag for deduplicating authors#2532

Merged
CYX22222003 merged 14 commits into
reposense:masterfrom
yizhong187:author-dedup-mode
Mar 9, 2026
Merged

[#2524] Add new --author-dedup-mode flag for deduplicating authors#2532
CYX22222003 merged 14 commits into
reposense:masterfrom
yizhong187:author-dedup-mode

Conversation

@yizhong187

Copy link
Copy Markdown
Contributor

Fixes #2524

Proposed commit message

Add deduplication flag

Allows for deduplating authors without specifying all authors to
display in repo (all authors are displayed, and deduplication is
applied onto them based on author-config)

Manual Testing

  1. Add author-config.csv into the config folder with the below content:
Repository's Location,Branch,Author's Git Host ID,Author's Emails,Author's Display Name,Author's Git Author Name,Ignore Glob List
,,YuLetian,,Yu Letian,Letian;Le Tian;Luoqi,
  1. Add repo-config.csv into the config folder with the below content:
Repository's Location,Branch,File formats,Find Previous Authors,Ignore Glob List,Ignore standalone config,Ignore Commits List,Ignore Authors List,Shallow Cloning,File Size Limit,Ignore File Size Limit,Skip Ignored File Analysis,Since Date,Until Date
https://github.com/AY2526S1-CS2103T-W11-1/tp.git,master,,,,,,,,,,,01/01/2025,
  1. Run ./gradlew run -Dargs="--config config --view --since 1/1/2025 --until 31/1/2026 --author-dedup-mode"
  2. There should be only one "Le Tian" present.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new --author-dedup-mode flag that allows users to deduplicate authors based on author-config.csv while displaying all commit authors in the report. This addresses issue #2524, which identified that the current approach requires listing ALL authors in author-config.csv even when only one author needs deduplication.

Changes:

  • Added --author-dedup-mode CLI flag that enables author deduplication based on configured aliases
  • Modified ReportGenerator.updateAuthorList() to add all commit authors when dedup mode is enabled, skipping those that match configured aliases
  • Added documentation for the new flag in the CLI reference guide

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/main/java/reposense/parser/ArgsParser.java Adds CLI flag definition and parsing logic for --author-dedup-mode
src/main/java/reposense/model/CliArguments.java Adds isAuthorDedupMode field, getter, and builder method; updates equals() method
src/main/java/reposense/model/RepoConfiguration.java Adds isAuthorDedupMode field, setter/getter, and static configuration method; includes formatting fixes for parameter alignment
src/main/java/reposense/RepoSense.java Propagates the isAuthorDedupMode flag to repo configurations
src/main/java/reposense/report/ReportGenerator.java Implements core deduplication logic in updateAuthorList() method
src/test/java/reposense/parser/ArgsParserTest.java Adds tests to verify the CLI flag is parsed correctly
docs/ug/cli.md Documents the new flag with usage instructions and requirements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 325 to +346
@@ -335,7 +342,8 @@ public static CliArguments parse(String[] args) throws HelpScreenException, Pars
.originalityThreshold(originalityThreshold)
.isPortfolio(isPortfolio)
.isFreshClonePerformed(shouldPerformFreshCloning)
.isOnlyTextRefreshed(shouldRefreshOnlyText);
.isOnlyTextRefreshed(shouldRefreshOnlyText)
.isAuthorDedupMode(isAuthorDedupMode);

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no validation to ensure that the --author-dedup-mode flag is used correctly. According to the documentation, this flag "must be used in conjunction with the --config flag and requires an author-config.csv file to be present." However, the code doesn't enforce this requirement.

If a user specifies --author-dedup-mode with --repos (instead of --config), or if they use --author-dedup-mode with --config but no author-config.csv exists, the flag will be silently ignored without any warning or error message. This could lead to user confusion.

Consider adding validation in ArgsParser.parse() to check if isAuthorDedupMode is true, and if so, verify that:

  1. configFolderPath is not the default path (or that --config was explicitly provided)
  2. Optionally, check if the author-config.csv file exists and warn if it doesn't

Alternatively, you could add a warning log in ReportGenerator.updateAuthorList() when isAuthorDedupMode is true but the conditions aren't met.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yizhong187 agreed, and i think it should just be limited to a warning. meaning if dedup flag is used but config flag is absent or config csv is absent, you can consider displaying a warning saying the dedup flag will be ignored. giving an error might be too much

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

Comment on lines +803 to +820
@Test
public void parse_withAuthorDedupMode_success() throws Exception {
String input = new InputBuilder()
.addRepos(TEST_REPO_REPOSENSE, TEST_REPO_BETA)
.add("--author-dedup-mode")
.build();
CliArguments cliArguments = ArgsParser.parse(translateCommandline(input));

Assertions.assertTrue(cliArguments.isAuthorDedupMode());
}

@Test
public void parse_withoutAuthorDedupMode_success() throws Exception {
String input = new InputBuilder().addRepos(TEST_REPO_REPOSENSE, TEST_REPO_BETA).build();
CliArguments cliArguments = ArgsParser.parse(translateCommandline(input));

Assertions.assertFalse(cliArguments.isAuthorDedupMode());
}

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test coverage for the author deduplication mode is insufficient. While these tests verify that the CLI flag is parsed correctly, there are no integration tests that verify the core deduplication logic in ReportGenerator.updateAuthorList().

Consider adding tests that verify:

  1. When author-config.csv contains configured authors with aliases, those aliases are correctly deduplicated
  2. Authors not in author-config.csv are added as new authors
  3. The interaction between configured authors and commit authors works as expected

Looking at RepoConfigurationTest.java, there's a pattern for testing updateAuthorList() using reflection (see the test repoConfig_removeIgnoredAuthors_success). A similar test should be added for author dedup mode to ensure the feature works correctly end-to-end.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yizhong187 might be out of scope - i dont see tests for the originality threshold config flag, for example. at the very least if you want to add tests for this feature, it shouldn't be part of the ParserTest file

@CYX22222003 CYX22222003 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT in general, just some small nitpicks to fix.

Comment thread src/main/java/reposense/report/ReportGenerator.java Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run the system tests locally on Windows. LGTM.

@CYX22222003
CYX22222003 merged commit 4ced2e8 into reposense:master Mar 9, 2026
10 checks passed
@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

The following links are for previewing this pull request:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flag to allow for deduplicating authors with authors-config.csv

4 participants