Skip to content

Commit 2b44385

Browse files
authored
Merge branch 'master' into 1941-remove-test-mode-flag
2 parents 07ed565 + ab87c6e commit 2b44385

File tree

38 files changed

+320
-116
lines changed

38 files changed

+320
-116
lines changed

.github/workflows/surge.yml

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
pr: ${{ steps.pr-number.outputs.ACTIONS_PR_NUMBER }}
4747
workflow_conclusion: success
4848
name: reposense-deployment-id
49+
allow_forks: true
4950
path: ./pr
5051

5152
- name: Update PR checklist for surge.sh as in progress

config/repo-config.csv

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
Repository's Location,Branch,File formats,Ignore Glob List,Ignore standalone config,Ignore Commits List,Ignore Authors List,Shallow Cloning,Find Previous Authors
2-
https://github.com/reposense/testrepo-Alpha.git,master,,,,2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7;c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151;cd7f610e0becbdf331d5231887d8010a689f87c7;768015345e70f06add2a8b7d1f901dc07bf70582,,,
3-
https://github.com/reposense/testrepo-Beta.git,master,fxml,docs**,yes,,,,
4-
https://github.com/reposense/testrepo-Beta.git,add-config-json,fxml,docs**,yes,,,,
5-
https://github.com/reposense/testrepo-Delta.git,master,override:java;md,,,,,,
6-
https://github.com/reposense/testrepo-Delta.git,nonExistentBranch,,,,,,,
7-
https://github.com/reposense/testrepo-Delta.git,add-binary-file,,,,,,,
8-
https://github.com/reposense/RepoSense.git,master,,,,,,,
9-
https://github.com/reposense/testrepo-Empty.git,master,,,,,,,
10-
ftp://github.com/reposense/RepoSense.git,master,,,,,,,
11-
https://bitbucket.org/skyblaise/testrepo-bitbucket.git,master,,,,,,,
12-
https://gitlab.com/reposense/testrepo-gitlab.git,main,,,,,,,
13-
https://[email protected]/p/repo-sense-test-repo/code,master,,,,,,,
1+
Repository's Location,Branch,File formats,Ignore Glob List,Ignore standalone config,Ignore Commits List,Ignore Authors List,Shallow Cloning,Find Previous Authors,Since Date,Until Date
2+
https://github.com/reposense/testrepo-Alpha.git,master,,,,2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7;c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151;cd7f610e0becbdf331d5231887d8010a689f87c7;768015345e70f06add2a8b7d1f901dc07bf70582,,,,,
3+
https://github.com/reposense/testrepo-Beta.git,master,fxml,docs**,yes,,,,,,
4+
https://github.com/reposense/testrepo-Beta.git,add-config-json,fxml,docs**,yes,,,,,,
5+
https://github.com/reposense/testrepo-Delta.git,master,override:java;md,,,,,,,,
6+
https://github.com/reposense/testrepo-Delta.git,nonExistentBranch,,,,,,,,,
7+
https://github.com/reposense/testrepo-Delta.git,add-binary-file,,,,,,,,,
8+
https://github.com/reposense/RepoSense.git,master,,,,,,,,,
9+
https://github.com/reposense/testrepo-Empty.git,master,,,,,,,,,
10+
ftp://github.com/reposense/RepoSense.git,master,,,,,,,,,
11+
https://bitbucket.org/skyblaise/testrepo-bitbucket.git,master,,,,,,,,,
12+
https://gitlab.com/reposense/testrepo-gitlab.git,main,,,,,,,,,
13+
https://[email protected]/p/repo-sense-test-repo/code,master,,,,,,,,,

docs/dg/learningBasics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Here are some small tasks for you to gain some basic knowledge of the code relat
111111
```
112112

113113
2. In the `Builder` class within `CliArguments`, add the following method to set `isPrettyPrintingUsed`.
114-
114+
115115
```java
116116
public Builder isPrettyPrintingUsed(boolean isPrettyPrintingUsed) {
117117
this.cliArguments.isPrettyPrintingUsed = isPrettyPrintingUsed;

docs/ug/configFiles.md

+16-14
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,22 @@ Given below are the details of the various config files used by RepoSense.
3131
**`repo-config.csv` file contains repo-level config data.** Each row represents a repository's configuration ([example](repo-config.csv)).
3232

3333

34-
| Column Name | Explanation |
35-
|-------------|-------------|
36-
| Repository's Location {{ mandatory }} | The `Remote Repo URL` or `Disk Path` to the Git repository e.g., `https://github.com/foo/bar.git` or `C:\Users\user\Desktop\GitHub\foo\bar` |
37-
| Branch | The branch to analyze in the target repository e.g., `master`. Default: the default branch of the repo |
38-
| File formats<sup>*+</sup> | The file extensions to analyze. Binary file formats, such as `png` and `jpg`, will be automatically labelled as the file type `binary` in the generated report. Default: all file formats |
39-
| Find Previous Authors | Enter **`yes`** to utilize Git blame's ignore revisions functionality, RepoSense will attempt to blame the line changes caused by commits in the ignore commit list to the previous authors who altered those lines (if available). |
40-
| Ignore Glob List<sup>*+</sup> | The list of file path globs to ignore during analysis for each author e.g., `test/**;temp/**`. Refer to the [_glob format_](https://docs.oracle.com/javase/tutorial/essential/io/fileOps.html#glob) for the path glob syntax. |
41-
| Ignore standalone config | To ignore the standalone config file (if any) in target repository, enter **`yes`**. If the cell is empty, the standalone config file in the repo (if any) will take precedence over configurations provided in the csv files. |
42-
| Ignore Commits List<sup>*+</sup> | The list of commits to ignore during analysis. For accurate results, the commits should be provided with their full hash. Additionally, a range of commits can be specified using the `..` notation e.g. `abc123..def456` (both inclusive). |
43-
| Ignore Authors List<sup>*+</sup> | The list of authors to ignore during analysis. Authors should be specified by their [Git Author Name](#a-note-about-git-author-name). |
44-
| Shallow Cloning | Enter **`yes`** to clone the repository using Git's shallow cloning functionality. This option can significantly reduce the time taken to clone large repositories. However, the option should ideally be disabled for smaller repositories where the `.git` file is smaller than 500 MB, as it would create overhead. |
45-
| File Size Limit<sup>+</sup> | Enter a file size limit for the repository in bytes as a single number without units (for a size limit of 1MB for example, enter 1000000). This file size limit will override the default file size limit (500KB). Files exceeding the file size limit will be marked as ignored and only the file name and line count will be reflected in the report. |
46-
| Ignore File Size Limit | Enter **`yes`** to ignore both the default file size limit and the file size limit possibly set by the user in `repo-config.csv`. |
47-
| Skip Ignored File Analysis | Enter **`yes`** to ignore analysis of files exceeding the file size limit entirely. If file analysis is skipped, all information about the file will be omitted from the generated report. This option can significantly improve report generation time. |
34+
| Column Name | Explanation |
35+
|---------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
36+
| Repository's Location {{ mandatory }} | The `Remote Repo URL` or `Disk Path` to the Git repository e.g., `https://github.com/foo/bar.git` or `C:\Users\user\Desktop\GitHub\foo\bar` |
37+
| Branch | The branch to analyze in the target repository e.g., `master`. Default: the default branch of the repo |
38+
| File formats<sup>*+</sup> | The file extensions to analyze. Binary file formats, such as `png` and `jpg`, will be automatically labelled as the file type `binary` in the generated report. Default: all file formats |
39+
| Find Previous Authors | Enter **`yes`** to utilize Git blame's ignore revisions functionality, RepoSense will attempt to blame the line changes caused by commits in the ignore commit list to the previous authors who altered those lines (if available). |
40+
| Ignore Glob List<sup>*+</sup> | The list of file path globs to ignore during analysis for each author e.g., `test/**;temp/**`. Refer to the [_glob format_](https://docs.oracle.com/javase/tutorial/essential/io/fileOps.html#glob) for the path glob syntax. |
41+
| Ignore standalone config | To ignore the standalone config file (if any) in target repository, enter **`yes`**. If the cell is empty, the standalone config file in the repo (if any) will take precedence over configurations provided in the csv files. |
42+
| Ignore Commits List<sup>*+</sup> | The list of commits to ignore during analysis. For accurate results, the commits should be provided with their full hash. Additionally, a range of commits can be specified using the `..` notation e.g. `abc123..def456` (both inclusive). |
43+
| Ignore Authors List<sup>*+</sup> | The list of authors to ignore during analysis. Authors should be specified by their [Git Author Name](#a-note-about-git-author-name). |
44+
| Shallow Cloning | Enter **`yes`** to clone the repository using Git's shallow cloning functionality. This option can significantly reduce the time taken to clone large repositories. However, the option should ideally be disabled for smaller repositories where the `.git` file is smaller than 500 MB, as it would create overhead. |
45+
| File Size Limit<sup>+</sup> | Enter a file size limit for the repository in bytes as a single number without units (for a size limit of 1MB for example, enter 1000000). This file size limit will override the default file size limit (500KB). Files exceeding the file size limit will be marked as ignored and only the file name and line count will be reflected in the report. |
46+
| Ignore File Size Limit | Enter **`yes`** to ignore both the default file size limit and the file size limit possibly set by the user in `repo-config.csv`. |
47+
| Skip Ignored File Analysis | Enter **`yes`** to ignore analysis of files exceeding the file size limit entirely. If file analysis is skipped, all information about the file will be omitted from the generated report. This option can significantly improve report generation time. |
48+
| Since Date | Enter since date in the format of `yyyy/mm/dd` to signify the start date of analysis. If the field is ignored, the date will be set to the default one or the date indicated in CLI flags |
49+
| Until Date | Enter since date in the format of `yyyy/mm/dd` to signify the end date of analysis. If the field is ignored, the date will be set to the default one or the date indicated in CLI flags |
4850

4951
<box type="info" seamless>
5052
The Shallow Cloning option is incompatible with the "--last-modified-date" CLI flag.

src/main/java/reposense/model/RepoConfiguration.java

+38-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ public class RepoConfiguration {
3030
private String branch = DEFAULT_BRANCH;
3131
private String displayName;
3232
private String outputFolderName;
33+
private LocalDateTime sinceDate;
34+
private LocalDateTime untilDate;
35+
3336
private transient String extraOutputFolderName = DEFAULT_EXTRA_OUTPUT_FOLDER_NAME;
3437
private transient ZoneId zoneId;
35-
private transient LocalDateTime sinceDate;
36-
private transient LocalDateTime untilDate;
3738
private transient String repoFolderName;
3839

3940
private transient FileTypeManager fileTypeManager = new FileTypeManager(Collections.emptyList());
@@ -54,6 +55,10 @@ public class RepoConfiguration {
5455
private transient boolean isFileSizeLimitOverriding = false;
5556
private transient boolean isIgnoredFileAnalysisSkipped = false;
5657

58+
private transient boolean hasUpdatedSinceDateInConfig = false;
59+
60+
private transient boolean hasUpdatedUntilDateInConfig = false;
61+
5762
/**
5863
* Constructs an empty instance of {@code RepoConfiguration}, which is used by the {@code Builder}
5964
* to construct new {@code RepoConfiguration} instances.
@@ -409,6 +414,22 @@ public Builder isIgnoredFileAnalysisSkipped(boolean isIgnoredFileAnalysisSkipped
409414
return this;
410415
}
411416

417+
public Builder setSinceDateBasedOnConfig(boolean hasUpdatedSinceDateInConfig, LocalDateTime since) {
418+
this.repoConfiguration.hasUpdatedSinceDateInConfig = hasUpdatedSinceDateInConfig;
419+
if (hasUpdatedSinceDateInConfig) {
420+
this.repoConfiguration.sinceDate = since;
421+
}
422+
return this;
423+
}
424+
425+
public Builder setUntilDateBasedOnConfig(boolean hasUpdatedUntilDateInConfig, LocalDateTime until) {
426+
this.repoConfiguration.hasUpdatedUntilDateInConfig = hasUpdatedUntilDateInConfig;
427+
if (hasUpdatedUntilDateInConfig) {
428+
this.repoConfiguration.untilDate = until;
429+
}
430+
return this;
431+
}
432+
412433
/**
413434
* Builds the {@code RepoConfiguration} object with the necessary configurations.
414435
*
@@ -449,8 +470,13 @@ private boolean validate() {
449470
public static void setDatesToRepoConfigs(List<RepoConfiguration> configs,
450471
LocalDateTime sinceDate, LocalDateTime untilDate) {
451472
for (RepoConfiguration config : configs) {
452-
config.setSinceDate(sinceDate);
453-
config.setUntilDate(untilDate);
473+
if (!config.hasUpdatedSinceDateInConfig) {
474+
config.setSinceDate(sinceDate);
475+
}
476+
477+
if (!config.hasUpdatedUntilDateInConfig) {
478+
config.setUntilDate(untilDate);
479+
}
454480
}
455481
}
456482

@@ -1011,6 +1037,14 @@ public boolean isFindingPreviousAuthorsPerformed() {
10111037
return isFindingPreviousAuthorsPerformed;
10121038
}
10131039

1040+
public boolean isHasUpdatedSinceDateInConfig() {
1041+
return hasUpdatedSinceDateInConfig;
1042+
}
1043+
1044+
public boolean isHasUpdatedUntilDateInConfig() {
1045+
return hasUpdatedUntilDateInConfig;
1046+
}
1047+
10141048
public AuthorConfiguration getAuthorConfig() {
10151049
return authorConfig;
10161050
}

0 commit comments

Comments
 (0)