Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#944] Implement authorship analysis #2150

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b4fc81b
add isAuthorshipAnalyzed flag
SkyBlaise99 Jul 26, 2023
1ea3210
add isAuthorshipAnalyzed to cli arguments
SkyBlaise99 Jul 26, 2023
5e2cdea
reformat cli args
SkyBlaise99 Jul 26, 2023
df5e498
added test cases for args parser
SkyBlaise99 Jul 27, 2023
9b77bda
reformat ArgsParserTest and InputBuilder
SkyBlaise99 Jul 27, 2023
689cdb3
update equals method in cli args
SkyBlaise99 Jul 27, 2023
cb0cf90
pass shouldAnalyzeAuthorship flag from reposense to report generator …
SkyBlaise99 Jul 30, 2023
81b7621
update javadocs for report generator and authorship reporter
SkyBlaise99 Jul 30, 2023
bce2fb2
reformat report generator and authorship reporter
SkyBlaise99 Jul 30, 2023
eb488bc
pass shouldAnalyzeAuthorship flag from authorship reporter to file in…
SkyBlaise99 Aug 1, 2023
e724d47
update javadocs for file info analyzer
SkyBlaise99 Aug 1, 2023
33e393d
add overloading method to fix failing testcases
SkyBlaise99 Aug 1, 2023
72921d7
implement authorship analyzer
SkyBlaise99 Aug 6, 2023
f3fbc33
reformat files
SkyBlaise99 Aug 6, 2023
f7cbe5b
set to default full credit
SkyBlaise99 Aug 7, 2023
03c1a2a
update expected outputs for local repo system tests
SkyBlaise99 Aug 7, 2023
acc6665
update expected outputs for config system tests
SkyBlaise99 Aug 7, 2023
71839dd
update comment
SkyBlaise99 Aug 7, 2023
c8442b8
add test cases for new git methods
SkyBlaise99 Aug 13, 2023
7b69c31
add AuthorshipAnalyzer test cases
SkyBlaise99 Aug 13, 2023
983c784
convert since date to millisec using config's zone id
SkyBlaise99 Aug 13, 2023
dc57517
fix error in obtaining commit time
SkyBlaise99 Aug 13, 2023
cadbeb2
shift getLevenshteinDistance to StringsUtil
SkyBlaise99 Aug 16, 2023
45539c1
fix warnings
SkyBlaise99 Aug 16, 2023
b2d6a08
Merge branch 'master' into 944-analyze-authorship
SkyBlaise99 Aug 17, 2023
397ca6f
store isFullCredit info into segments
SkyBlaise99 Aug 18, 2023
40a7598
store as a single value when the whole segment are all full credit,
SkyBlaise99 Aug 18, 2023
9272869
rename variable
SkyBlaise99 Aug 18, 2023
00c4036
update background for is not full credit
SkyBlaise99 Aug 18, 2023
97f1966
Merge branch 'master' into 944-analyze-authorship
SkyBlaise99 Aug 24, 2023
971cc80
switch to jdk 8 methods
SkyBlaise99 Aug 24, 2023
8293e0f
remove unused imports
SkyBlaise99 Aug 24, 2023
f8a8f30
Merge branch 'master' into 944-analyze-authorship
SkyBlaise99 Sep 1, 2023
489cf6d
fix null pointer exception caused by
SkyBlaise99 Sep 5, 2023
a8b0b19
[#944] Fix failing frontend tests (#2068)
SkyBlaise99 Nov 11, 2023
b827cc8
[#944] Fix wrong credit information inherited by annotated author (#2…
SkyBlaise99 Nov 12, 2023
086a64b
[#944] Improve visualization for full and partial credit (#2070)
SkyBlaise99 Jan 8, 2024
c85423e
[#944] Change to originality score and new threshold value (#2072)
SkyBlaise99 Jan 8, 2024
e8cb72a
[#944] Differentiate full and partial credit when group is merged (#2…
SkyBlaise99 Jan 27, 2024
79209a3
[#944] Add originality threshold flag (#2122)
SkyBlaise99 Mar 3, 2024
fdd2dae
[#944] Improve performance (#2108)
SkyBlaise99 Mar 3, 2024
b90b9a3
[#944] Resolve Merge Conflict (#2139)
SkyBlaise99 Mar 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ RepoSense is a contribution analysis tool for Git repositories. It is particular
- [User Guide for the latest `master` (not yet released to users)](https://reposense.github.io/RepoSense)

---
### Our Contributors :
<a href="https://github.com/reposense/RepoSense/graphs/contributors">
<img src="https://contrib.rocks/image?repo=reposense/RepoSense" />
</a>

**Acknowledgements**: The web previews of RepoSense is powered by Netlify and Surge.

Expand Down
4 changes: 2 additions & 2 deletions docs/dg/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* [`GitBranch`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/git/GitBranch.java): Wrapper class for `git branch` functionality. Gets the name of the working branch of the target repo.
* [`GitCatFile`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/git/GitCatFile.java): Wrapper class for `git cat-file` functionality. Obtains the parent commit hash with the given commit indicated by the commit hash.
* [`GitCheckout`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/git/GitCheckout.java): Wrapper class for `git checkout` functionality. Checks out the repository by branch name or commit hash.
* [`GitClone`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/git/GitClone.java): Wrapper class for `git clone` functionality. Clones the repository from *GitHub* into a temporary folder in order to run the analysis.
* [`GitClone`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/git/GitClone.java): Wrapper class for `git clone` functionality. Clones the repository from the given URL or local directory into a temporary folder in order to run the analysis.
* [`GitDiff`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/git/GitDiff.java): Wrapper class for `git diff` functionality. Obtains the changes between commits.
* [`GitLog`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/git/GitLog.java): Wrapper class for `git log` functionality. Obtains the commit logs and the authors' info.
* [`GitRevList`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/git/GitRevList.java): Wrapper class for `git rev-list` functionality. Retrieves the commit objects in reverse chronological order.
Expand Down Expand Up @@ -93,7 +93,7 @@ Note that when constructing new commands containing path arguments, use the `Str
## Model

[`Model`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/model) holds the data structures that are commonly used by the different aspects of *RepoSense*.
* [`Author`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/model/Author.java) stores the `GitHub ID` of an author. Any contributions or commits made by the author, using his/her `GitHub ID` or aliases, will be attributed to the same `Author` object. `AuthorshipReporter` and `CommitsReporter` use it to attribute the commit and file contributions to the respective authors.
* [`Author`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/model/Author.java) stores the `Git ID` of an author. Any contributions or commits made by the author, using his/her `Git ID` or aliases, will be attributed to the same `Author` object. `AuthorshipReporter` and `CommitsReporter` use it to attribute the commit and file contributions to the respective authors.
* [`CliArguments`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/model/CliArguments.java) stores the parsed command-line arguments supplied by the user. It contains the configuration settings such as the CSV config file to read from, the directory to output the report to, and the date range of commits to analyze. These configuration settings are passed into `RepoConfiguration`.
* [`FileTypeManager`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/model/FileTypeManager.java) stores the file format to be analyzed and the custom groups specified by the user for any repository.
* [`RepoConfiguration`](https://github.com/reposense/RepoSense/blob/master/src/main/java/reposense/model/RepoConfiguration.java) stores the configuration information from the CSV config file for a single repository: the repository's organization, name, branch, list of authors to analyze, date range to analyze commits, and files from `CliArguments`.
Expand Down
24 changes: 12 additions & 12 deletions docs/dg/learningBasics.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

Therefore, the first step you can take is to add the following to `ArgsParser`.

```
```java
public static final String[] JSON_PRINT_MODE_FLAGS = new String[]{"--use-json-pretty-printing", "-j"};
```

In `getArgumentParser` method, add the following content to make `ArgumentParser` capture the new argument.

```
```java
parser.addArgument(JSON_PRINT_MODE_FLAGS)
.dest(JSON_PRINT_MODE_FLAGS[0])
.action(Arguments.storeTrue())
Expand All @@ -102,7 +102,7 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

1. Add the following content to `CliArguments` to include `isPrettyPrintingUsed` as a new attribute to the class.

```
```java
protected boolean isPrettyPrintingUsed;

public boolean isPrettyPrintingUsed() {
Expand All @@ -112,13 +112,13 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

2. In the constructor of `ConfigCliArguments`, add `isPrettyPrintingUsed` as a new parameter of the method, and add the following instruction to the method body.

```
```java
this.isPrettyPrintingUsed = isPrettyPrintingUsed;
```

3. In the `parse` method of `ArgsParser`, add the following instruction to get `isJsonPrettyPrintingUsed` from `ArgmentParser`.

```
```java
boolean isJsonPrettyPrintingUsed = results.get(JSON_PRINT_MODE_FLAGS[0]);
```

Expand All @@ -139,13 +139,13 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

2. Add the following content to `FileUtil`.

```
```java
private static boolean isPrettyPrintingUsed = false;
```

3. In the `writeJsonFile` method, Replace the creation of the `Gson` object with the following instructions.

```
```java
GsonBuilder gsonBuilder = new GsonBuilder()
.registerTypeAdapter(LocalDateTime.class, (JsonSerializer<LocalDateTime>) (date, typeOfSrc, context)
-> new JsonPrimitive(date.format(DateTimeFormatter.ofPattern(GITHUB_API_DATE_FORMAT))))
Expand All @@ -160,15 +160,15 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

4. To notify `FileUtil` of the switch between different printing mode, add the following method to `FileUtil`.

```
```java
public static void setPrettyPrintingMode(boolean isPrettyPrintingAdopted) {
isPrettyPrintingUsed = isPrettyPrintingAdopted;
}
```

5. It is now possible to notify `FileUtil` of the printing mode switch by extracting the argument from the `CliArguments` object in the `main` method of `RepoSense.java` and passing it to the corresponding method in `FileUtil`.

```
```java
FileUtil.setPrettyPrintingMode(cliArguments.isPrettyPrintingUsed());
```

Expand Down Expand Up @@ -225,7 +225,7 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

Add this to the catch block of `spawnCloneProcess` and `waitForCloneProcess`, so that the message will be captured in `summary.json`.

```
```java
ErrorSummary.getInstance().addErrorMessage(config.getDisplayName(), e.getMessage());
```
</panel>
Expand Down Expand Up @@ -358,7 +358,7 @@ Here are some small tasks for you to gain some basic knowledge of the code relat

Add this to `c_summary.scss`.

```
```css
.active-text {
color: mui-color('green');
}
Expand Down Expand Up @@ -485,4 +485,4 @@ You can now proceed to learn the [contributing workflow](workflow.html).

## DevOps

If you want to understand and contribute to the DevOps aspect of RepoSense, you can refer to the [DevOps guide](https://github.com/reposense/RepoSense/wiki/DevOps-guide) for more information.
If you want to understand and contribute to the DevOps aspect of RepoSense, you can refer to the [DevOps guide](devOpsGuide.html) for more information.
2 changes: 1 addition & 1 deletion docs/dg/settingUp.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<box type="info" seamless>

Type `java -version`, `npm -v` and `git --version` respectively on your OS terminal and ensure that you have the correct version of each prerequisite installed.
Type `java -version`, `node -v` and `git --version` respectively on your OS terminal and ensure that you have the correct version of each prerequisite installed.
</box>

<!-- ==================================================================================================== -->
Expand Down
24 changes: 12 additions & 12 deletions docs/dg/styleGuides.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Our coding standards are mostly based on those at [se-education.org/guides](http

## Note on Ternary Operators:
Ternary operators can be used to shorten if-else blocks such as this:
```
```java
LocalDateTime min = ARBITRARY_FIRST_COMMIT_DATE_UTC.withZoneSameInstant(zoneId).toLocalDateTime();
if (!commitInfos.isEmpty()) {
min = commitInfos.get(0).getTime();
Expand All @@ -31,7 +31,7 @@ return min;
```

The result would look something like this:
```
```java
return (commitInfos.isEmpty())
? ARBITRARY_FIRST_COMMIT_DATE_UTC.withZoneSameInstant(zoneId).toLocalDateTime()
: commitInfos.get(0).getTime();
Expand All @@ -48,16 +48,16 @@ In addition to what has been mentioned in the [**Java** coding standard (SE-EDU)
* This is not necessary (although still recommended) for methods with `@Override` annotations if Javadoc is used. However, if the method that is being overriden is part of your code and has Javadoc, all parameters must be described.

Negative Examples:
```
Not okay (Only mentions zoneId parameter):
```java
// Not okay (Only mentions zoneId parameter):
/**
* Returns a {@link LocalDateTime} object adjusted for timezone given by {@code zoneId}.
*/
public LocalDateTime adjustTimeZone(LocalDateTime sinceDate, ZoneId zoneId) {
//Code here
}

Not okay (@param tag used only for zoneId)
// Not okay (@param tag used only for zoneId)
/**
* Returns a {@link LocalDateTime} object by adjusting {@code sinceDate}
* to the timezone given by {@code zoneId}.
Expand All @@ -69,8 +69,8 @@ public LocalDateTime adjustTimeZone(LocalDateTime sinceDate, ZoneId zoneId) {
}
```
Positive Example #1:
```
Okay (No @param tags):
```java
// Okay (No @param tags):
/**
* Returns a {@link LocalDateTime} object by adjusting {@code sinceDate}
* to the timezone given by {@code zoneId}.
Expand All @@ -80,8 +80,8 @@ public LocalDateTime adjustTimeZone(LocalDateTime sinceDate, ZoneId zoneId) {
}
```
Positive Example #2:
```
Okay (@param tags used for all inputs):
```java
// Okay (@param tags used for all inputs):
/**
* Returns a {@link LocalDateTime} object by adjusting {@code sinceDate}
* to the timezone given by {@code zoneId}.
Expand All @@ -98,8 +98,8 @@ public LocalDateTime adjustTimeZone(LocalDateTime sinceDate, ZoneId zoneId) {
* This requirement does not apply to test code.
* One `@throws` tag per unique exception.
* The order of exceptions in the `@throws` tag block should match that of the method's `throws` statement.
```
Not okay (order of exceptions in tag block and method signature do not match):
```java
// Not okay (order of exceptions in tag block and method signature do not match):
/**
* Returns a {@link LocalDateTime} object from {@code dateString}.
*
Expand All @@ -111,7 +111,7 @@ public LocalDateTime parseDate(String dateString) throws NullPointerException, P
// Code here
}

Should be:
// Should be:
/**
* Returns a {@link LocalDateTime} object from {@code dateString}.
*
Expand Down
3 changes: 2 additions & 1 deletion docs/ug/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ The section below provides explanations for each of the flags.
<div id="section-assets">

**`--assets ASSETS_DIRECTORY`**: Specifies where to place assets for report generation.
* Parameter: `ASSETS_DIRECTORY` The directory containing the assets files. A `favicon.ico` file can be placed here to customize the favicon of the dashboard.
* Parameter: `ASSETS_DIRECTORY` The directory containing the assets files. A `favicon.ico` file can be placed here to customize the favicon of the dashboard,
while a `title.md` file can be placed to customize the header of the report using [Markdown syntax](https://www.markdownguide.org/basic-syntax/).
* Alias: `-a`
* Example: `--assets ./assets` or `-a ./assets`

Expand Down
14 changes: 7 additions & 7 deletions docs/ug/configFiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ To use this feature, add a `_reposense/config.json` to the root of your repo usi
"authors":
[
{
"githubId": "alice",
"gitId": "alice",
"emails": ["[email protected]", "[email protected]"],
"displayName": "Alice T.",
"authorNames": ["AT", "A"],
"ignoreGlobList": ["**.css"]
},
{
"githubId": "bob"
"gitId": "bob"
}
]
}
Expand All @@ -159,10 +159,10 @@ Note: all fields are optional unless specified otherwise.

**Fields to provide _author-level_ info**:<br>
Note: `authors` field should contain _all_ authors that should be captured in the analysis.
* `githubId`: Username of the author. {{ mandatory }} field.
* `gitId`: Username of the author. {{ mandatory }} field.
* `emails`: Associated git emails of the author. For GitHub, this can be found in your [GitHub settings](https://github.com/settings/emails).
* `displayName`: Name to display on the report for this author.
* `authorNames`: Git Author Name(s) used in the author's commits. By default, RepoSense assumes an author would use her GitHub username as the Git username too. The meaning of _Git Author Name_ is explained in [_A note about git author name_](#a-note-about-git-author-name).
* `authorNames`: Git Author Name(s) used in the author's commits. By default, RepoSense assumes an author would use their remote Git Host username as the Git username too. The meaning of _Git Author Name_ is explained in [_A note about git author name_](#a-note-about-git-author-name).
* `ignoreGlobList`: _Additional_ (i.e. on top of the repo-level `ignoreGlobList`) folders/files to ignore for a specific author. The path glob syntax is specified by the [_glob format_](https://docs.oracle.com/javase/tutorial/essential/io/fileOps.html#glob). In the example above, the actual `ignoreGlobList` for `alice` would be `["about-us/**", "**index.html", "**.css"]`.

To verify your standalone configuration is as intended, add the `_reposense/config.json` to your local copy of repo and run RepoSense against it as follows:<br>
Expand Down Expand Up @@ -190,15 +190,15 @@ Date: Fri Feb 9 19:13:13 2018 +0800
```
`ActualGitHostId` and `ConfiguredAuthorName` are both `Git Author Name` of the same author.<br>
To find the author name that you are currently using for your current git repository, run the following command within your git repository:
``` {.no-line-numbers}
``` shell {.no-line-numbers}
git config user.name
```
To set the author name to the value you want (e.g., to set it to your GitHub username) for your current git repository, you can use the following command ([more info](https://www.git-tower.com/learn/git/faq/change-author-name-email)):
``` {.no-line-numbers}
``` shell {.no-line-numbers}
git config user.name "YOUR_AUTHOR_NAME”
```
To set the author name to use a default value you want for future git repositories, you can use the following command:
``` {.no-line-numbers}
``` shell {.no-line-numbers}
git config --global user.name "YOUR_AUTHOR_NAME”
```
RepoSense expects the Git Author Name to be the same as author's username on the Git hosting platform (GitHub, GitLab, BitBucket). If an author's `Git Author Name` is different from their username on the Git hosting platform, the `Git Author Name` needs to be specified in the standalone config file. If the author has more than one `Git Author Name`, multiple values can be entered too.
Expand Down
4 changes: 2 additions & 2 deletions docs/ug/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

### Contributions missing in the ramp chart (but appear in the contribution bar and code panel)

This is probably a case of giving an incorrect author name alias (or GitHub ID) in your [author-config file](./configFiles.md#author-config-csv).<br>
This is probably a case of giving an incorrect author name alias (or Git ID) in your [author-config file](./configFiles.md#author-config-csv).<br>
Please refer to [A Note About Git Author Name](./configFiles.md#a-note-about-git-author-name) above on how to find out the correct author name you are using and how to change it.<br>
Also, ensure that you have added all author name aliases you may be using (if you are using multiple computers or have previously changed your author name).<br>
Alternatively, you may choose to configure *RepoSense* to track using your GitHub email instead of in your [standalone config file](./configFiles.md#config-json-standalone-config-file) or [author-config file](./configFiles.md#author-config-csv), which is more accurate compared to author name aliases. The associated GitHub email you are using can be found in your [GitHub settings](https://github.com/settings/emails).
Alternatively, you may choose to configure *RepoSense* to track the email associated with your local Git config or remote Git host email in a [standalone config file](./configFiles.md#config-json-standalone-config-file) or [author-config file](./configFiles.md#author-config-csv), which is more accurate compared to author name aliases. For GitHub, the associated email you are using can be found in your [GitHub settings](https://github.com/settings/emails).


<!-- ------------------------------------------------------------------------------------------------------ -->
Expand Down
21 changes: 20 additions & 1 deletion frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,26 @@
}
],
"@typescript-eslint/member-delimiter-style": "error",
"@typescript-eslint/type-annotation-spacing": "error"
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/array-type": [
"error",
{
"default": "array-simple",
"readonly": "array-simple"
}
]
}
},
{
"files": ["*.vue"],
"rules": {
"@typescript-eslint/array-type": [
"error",
{
"default": "generic",
"readonly": "generic"
}
]
}
}
]
Expand Down
4 changes: 3 additions & 1 deletion frontend/.stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"scss/no-global-function-names": null,
"selector-type-no-unknown": null,
"at-rule-no-unknown": null,
"no-duplicate-selectors": null
"no-duplicate-selectors": null,
"block-opening-brace-space-before": "always",
"declaration-colon-space-before": "never"
}
}
Loading
Loading