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

[#1572] Accept different types of URLs besides https github #1644

Merged
merged 133 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from 105 commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
0dcdafe
Fix rebase conflict
chan-j-d Jan 29, 2022
17091d7
Fix rebase conflict
chan-j-d Jan 29, 2022
9d4b3e8
Remove invalidLocation test case
chan-j-d Jan 29, 2022
1746b05
Remove unnecessary files and variables
chan-j-d Jan 29, 2022
e42e297
Fix checkstyle issues
chan-j-d Jan 29, 2022
8463060
Change regex matching patterns
chan-j-d Jan 29, 2022
842d791
Fix regex matching pattern logic
chan-j-d Jan 29, 2022
6b402c0
Change organisation logic to path
chan-j-d Jan 30, 2022
bf074d8
Include empty string case
chan-j-d Jan 30, 2022
ad8e43e
Rollback array change to match existing test cases
chan-j-d Jan 30, 2022
a73e5e7
Add test cases for repo name and org determination
chan-j-d Jan 30, 2022
6ef5ccd
Fix checkstyle issues
chan-j-d Jan 30, 2022
a94ded4
Change to equals method
chan-j-d Jan 30, 2022
e9ea264
Fix merge conflicts
chan-j-d Jan 30, 2022
4d4bda1
Update ssh pattern
chan-j-d Jan 30, 2022
15ea7f1
Remove redundant error summary test
chan-j-d Feb 1, 2022
e44243d
Update system test json files
chan-j-d Feb 1, 2022
9dcf667
Remove support for 'file://' url types
chan-j-d Feb 1, 2022
e294d7a
Change test cases to be OS dependent
chan-j-d Feb 1, 2022
c71b11b
Remove wrong replace statement
chan-j-d Feb 1, 2022
0773e3e
Delete accidental gradlew.bak file
chan-j-d Feb 1, 2022
3ad7cf7
Retrigger github actions
chan-j-d Feb 2, 2022
21545fb
Change method back to organization
chan-j-d Feb 2, 2022
3b1c21a
Readd ErrorSummaryTest class
chan-j-d Feb 2, 2022
2f763bc
Fix checkstyle issue
chan-j-d Feb 2, 2022
a4328a4
Add test cases for isLocalRepo method
chan-j-d Feb 2, 2022
2e65395
Fix checkstyle issues
chan-j-d Feb 2, 2022
0604203
Remove support for 'file://' type arguments
chan-j-d Feb 2, 2022
bd305f4
Add general changes from comments
chan-j-d Feb 4, 2022
2537bea
Add new test cases and adjust regex expression
chan-j-d Feb 4, 2022
2d7ecc9
Update system test cases
chan-j-d Feb 4, 2022
3be3d64
Revert error summary test cases
chan-j-d Feb 4, 2022
cb6c5c8
Fix checkstyle issues
chan-j-d Feb 4, 2022
6c0853b
Readd support for file://
chan-j-d Feb 8, 2022
931aab4
Fix test case for linux
chan-j-d Feb 8, 2022
8314465
Update and add test cases for disk drive
chan-j-d Feb 10, 2022
707d661
Fix faulty logic with local repo determination
chan-j-d Feb 10, 2022
c552675
Change the valid file path to work only on windows
chan-j-d Feb 10, 2022
991bb1a
Retrigger github actions
chan-j-d Feb 10, 2022
927ce3b
Change stringsutil
chan-j-d Feb 12, 2022
294a023
Change to single quote for linux
chan-j-d Feb 12, 2022
496ba31
Change filepath quotation methods
chan-j-d Feb 12, 2022
adc344d
Change one additional addQuotes to addQuotesForFiles
chan-j-d Feb 12, 2022
c26250d
Fix checkstyle issues in main
chan-j-d Feb 12, 2022
7bd74f5
Add bash test case
chan-j-d Feb 12, 2022
342dc02
Change quotation logic
chan-j-d Feb 12, 2022
c029c58
Change test case
chan-j-d Feb 12, 2022
a55f2d3
Adjust bash test case
chan-j-d Feb 12, 2022
e4af539
Add println
chan-j-d Feb 12, 2022
c4d9a0b
Remove println statements
chan-j-d Feb 13, 2022
51ff1a2
Add println tests
chan-j-d Feb 13, 2022
34ec18c
Fix test case once and for all
chan-j-d Feb 13, 2022
e0402d6
Add note about path argument to DG
chan-j-d Feb 13, 2022
d6b1711
Fix checkstyle
chan-j-d Feb 13, 2022
4cd9fd1
Add comment containing the link referencing the issue
chan-j-d Feb 13, 2022
7765314
Change to answer link
chan-j-d Feb 13, 2022
712169d
Merge branch 'master' into 1657-escape-special-chars-in-bash-command
gerhean Feb 13, 2022
124d39c
Merge branch '1657-escape-special-chars-in-bash-command' of github.co…
chan-j-d Feb 13, 2022
57e5d6e
Change notification to use markbind box instead
chan-j-d Feb 14, 2022
81c9e81
Update architecture.md
chan-j-d Feb 14, 2022
9734f85
Revert without backslash
chan-j-d Feb 14, 2022
0f2cb5a
Change to two separate code strings without colon
chan-j-d Feb 14, 2022
38ab0f1
Add new line between box header
chan-j-d Feb 14, 2022
765d227
Change up logic and add javadocs
chan-j-d Feb 14, 2022
0ca269b
Fix test cases
chan-j-d Feb 14, 2022
4486fca
Fix checkstyle violations
chan-j-d Feb 14, 2022
8a445f1
Change repolocation to also replace : and |
chan-j-d Feb 21, 2022
44ebaf1
Merge branch 'master' into 1657-escape-special-chars-in-bash-command
chan-j-d Feb 21, 2022
c4dc164
Fix method name
chan-j-d Feb 21, 2022
294fc9e
Change command pathing
chan-j-d Feb 21, 2022
16c7db6
Remove relativise
chan-j-d Feb 21, 2022
20b7991
Add disk drive support
chan-j-d Feb 21, 2022
fbb840d
Merge branch 'master' into 1572-experimental-implementation
chan-j-d Feb 21, 2022
2987656
Fix broken test cases
chan-j-d Feb 21, 2022
ed9df69
Fix merge issues
chan-j-d Feb 24, 2022
60f57e3
Fix merge conflicts with 1682
chan-j-d Feb 24, 2022
067dee8
Add domain support in regex
chan-j-d Mar 12, 2022
d4fe602
Build patterns via incremental blocks
chan-j-d Mar 12, 2022
66b11d9
Add domain name support
chan-j-d Mar 12, 2022
fe4f92d
Add support for prebuilt supported domains
chan-j-d Mar 12, 2022
b3167fe
Change implementation to have constants in Java class itself
chan-j-d Mar 12, 2022
5053e69
Implement solution that works during compile time
chan-j-d Mar 12, 2022
2622251
Tag supported domains to summaryjson
chan-j-d Mar 12, 2022
819eab8
Fix mapping bug in js
chan-j-d Mar 12, 2022
df6aa9c
Add support for other link types for ramp link
chan-j-d Mar 12, 2022
dc5fa71
Include unsupported urls in map
chan-j-d Mar 12, 2022
a130820
Change links in v-summary-charts
chan-j-d Mar 12, 2022
ba5fa38
Add support for history paths
chan-j-d Mar 12, 2022
7938863
Add link change to v-authorship.vue
chan-j-d Mar 12, 2022
2dc1317
Fix links in v-zoom.vue
chan-j-d Mar 12, 2022
8cee7b1
Change BASE_URL to be default reposense url
chan-j-d Mar 12, 2022
d9e3c6d
Change up system file test expected files
chan-j-d Mar 13, 2022
96b807d
Simplify DOMAIN_URL_MAP in api.js
chan-j-d Mar 13, 2022
550080d
Remove redundant assignment
chan-j-d Mar 13, 2022
871a770
Implement new filepath validation without logging
chan-j-d Mar 13, 2022
06a1820
Refactor names to be more intuitive
chan-j-d Mar 14, 2022
a7b03c5
Edit using reports to include details about github, gitlab and bitbucket
chan-j-d Mar 14, 2022
a2efe36
Add info on generating reports
chan-j-d Mar 14, 2022
a733840
Update references with github in configFiles.md
chan-j-d Mar 14, 2022
2359d6a
Resolve merge conflict
chan-j-d Mar 14, 2022
a59c6a9
Fix unfixed merge conflict
chan-j-d Mar 15, 2022
2c4eaeb
Replace leftover removed method
chan-j-d Mar 15, 2022
78b114c
Change buttons to not open a link when unsupported
chan-j-d Mar 16, 2022
179b66b
Merge branch '1572-experimental-implementation' of github.com:chan-j-…
chan-j-d Mar 16, 2022
5a659c7
Add test cases for domain testing
chan-j-d Mar 16, 2022
7576b50
Revert column header change for author-config
chan-j-d Mar 21, 2022
5f48dfc
Fix issue accidental replacement issue
chan-j-d Mar 22, 2022
2a62b79
Change icon to generic git icon
chan-j-d Mar 23, 2022
4b09e9e
Update docs/ug/configFiles.md
chan-j-d Mar 23, 2022
70e2141
Merge branch '1572-experimental-implementation' of github.com:chan-j-…
chan-j-d Mar 23, 2022
d238d02
Add examples to external webpages
chan-j-d Mar 23, 2022
104baf2
Update recognised to recognized
chan-j-d Mar 23, 2022
1f7b75e
Change SupportedDomainUrlMap to add only urls used
chan-j-d Mar 23, 2022
1dd063e
Fix bug relating to local repos
chan-j-d Mar 23, 2022
e07dbd5
Replace 30 days systemTest expected files
chan-j-d Mar 23, 2022
6d7529a
Update summary.json files
chan-j-d Mar 23, 2022
3e4d451
Add test cases for SupportedDomainUrlMap.java
chan-j-d Mar 23, 2022
3fbc3d7
Fix checkstyle issues
chan-j-d Mar 23, 2022
e007f2a
Merge branch '1572-experimental-implementation' of github.com:chan-j-…
chan-j-d Mar 23, 2022
0c2ca41
Fix misused key instead of placeholder
chan-j-d Mar 23, 2022
7cebe8a
Add missing $
chan-j-d Mar 23, 2022
03939b0
Merge branch 'master' into 1572-experimental-implementation
chan-j-d Mar 23, 2022
5f9e45f
Fix resources
chan-j-d Mar 23, 2022
ff08591
Remove leftover changes in TestUtil
chan-j-d Mar 23, 2022
5fa477e
Merge master branch
chan-j-d Mar 25, 2022
2d00bc5
Change icon to file-code
chan-j-d Mar 25, 2022
804f8c3
Resolve merge conflicts
chan-j-d Mar 26, 2022
6583b0f
Fix checkstyle issues
chan-j-d Mar 26, 2022
a577c12
Revert "Change icon to file-code"
chan-j-d Mar 26, 2022
f6083b5
Change icon to database
chan-j-d Mar 26, 2022
3faefcf
Resolve merge conflicts
chan-j-d Mar 27, 2022
a5cff50
Change import class
chan-j-d Mar 27, 2022
e12182e
Merge branch 'master' into 1572-experimental-implementation
dcshzj Mar 28, 2022
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
20 changes: 10 additions & 10 deletions docs/ug/configFiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Given below are the details of the various config files used by RepoSense.

| Column Name | Explanation |
|-------------|-------------|
| Repository's Location {{ mandatory }} | The `GitHub URL` or `Disk Path` to the git repository e.g., `https://github.com/foo/bar.git` or `C:\Users\user\Desktop\GitHub\foo\bar` |
| 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` |
| Branch | The branch to analyze in the target repository e.g., `master`. Default: the default branch of the repo |
| 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 |
| 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). |
Expand Down Expand Up @@ -63,9 +63,9 @@ Optionally, you can use an `author-config.csv` (which should be in the same dire
|-------------|-------------|
| Repository's Location | Same as `repo-config.csv`. Default: all the repos in `repo-config.csv` |
| Branch | The branch to analyze for this author, e.g., `master`. Default: the author will be bound to all the repos in `repo-config.csv` that has the same repo's location, regardless of branch. |
| Author's GitHub ID {{ mandatory }} | GitHub username of the target author, e.g., `JohnDoe` |
| Author's Emails<sup>*</sup> | Associated Github emails of the author. This can be found in your [GitHub settings](https://github.com/settings/emails). |
| Author's Display Name | The name to display for the author. Default: author's GitHub username. |
| Author's Git Host ID {{ mandatory }} | Username of the target author's profile on GitHub, GitLab or Bitbucket, e.g.`JohnDoe`. |
| Author's Emails<sup>*</sup> | Associated emails of the author. For GitHub users, this can be found in your [GitHub settings](https://github.com/settings/emails). |
| Author's Display Name | The name to display for the author. Default: author's username. |
| Author's Git Author Name<sup>*</sup> | The meaning of _Git Author Name_ is explained in [_A note about git author name_](#a-note-about-git-author-name). |
| Ignore Glob List<sup>*</sup> | Files to ignore for this author, in addition to files ignored by the patterns specified in `repo-config.csv`. The path glob syntax is the same as that of Ignore Glob List in `repo-config.csv`. |

Expand Down Expand Up @@ -107,7 +107,7 @@ You can optionally use `report-config.json` to customize report generation by pr

Repo owners can provide the following additional information to RepoSense using a config file that we call the **_standalone config file_**:
* which files/authors/commits to analyze/omit
* which git and GitHub usernames belong to which authors
* which git and git host usernames belong to which authors
* the display of an author

To use this feature, add a `_reposense/config.json` to the root of your repo using the format in the example below ([another example](https://github.com/reposense/RepoSense/blob/master/_reposense/config.json)) and **commit it** (reason: RepoSense can see committed code only):
Expand Down Expand Up @@ -143,8 +143,8 @@ 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`: GitHub username of the author. {{ mandatory }} field.
* `emails`: Associated GitHub emails of the author. This can be found in your [GitHub settings](https://github.com/settings/emails).
* `githubId`: Username of the author. {{ mandatory }} field.
dcshzj marked this conversation as resolved.
Show resolved Hide resolved
* `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).
* `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"]`.
Expand All @@ -166,13 +166,13 @@ Date: Fri Feb 9 19:14:41 2018 +0800
Make some changes to show my new author's name

commit e3f699fd4ef128eebce98d5b4e5b3bb06a512f49
Author: ActualGitHubId <author@example.com>
Author: ActualGitHostId <author@example.com>
Date: Fri Feb 9 19:13:13 2018 +0800

Initial commit
...
```
`ActualGitHubId` and `ConfiguredAuthorName` are both `Git Author Name` of the same author.<br>
`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}
git config user.name
Expand All @@ -185,7 +185,7 @@ To set the author name to use a default value you want for future git repositori
``` {.no-line-numbers}
git config --global user.name "YOUR_AUTHOR_NAME”
```
RepoSense expects the Git Author Name to be the same as author's GitHub username. If an author's `Git Author Name` is different from her `GitHub ID`, 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.
RepoSense expects the Git Author Name to be the same as author's Git Host (GitHub, GitLab, BitBucket) username. If an author's `Git Author Name` is different from her `GitHost ID`, 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.
chan-j-d marked this conversation as resolved.
Show resolved Hide resolved

<box type="warning" seamless>

Expand Down
6 changes: 6 additions & 0 deletions docs/ug/generatingReports.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ Let's look at different ways to generate RepoSense reports.

* **If you don't have Java on your computer or do not wish to run the executable on your computer**, some alternatives are provided in the [_Generating reports remotely_](#generating-reports-remotely) section below.

<box type="info" seamless>

RepoSense is built to analyze any type of git repo, remote or local. It works best when analyzing remote repositories hosted on GitHub, GitLab or BitBucket.
For other types of repositories, features such as external links might not work properly.
dcshzj marked this conversation as resolved.
Show resolved Hide resolved
</box>

<!-- ==================================================================================================== -->

## Generating reports locally
Expand Down
14 changes: 10 additions & 4 deletions docs/ug/usingReports.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ As a report consists of web pages, it can be viewed using a Web Browser. Here ar
1. Open the `index.html` (in the unzipped report directory) using a browser.
1. If the report was not loaded automatically, click on the `choose file` button in the shown web page, and select the `archive.zip` (in the same directory) manually.<br>
If even the `choose file` button is not showing up, try a different browser.

<!-- ==================================================================================================== -->

## Report structure
Expand All @@ -39,6 +38,11 @@ Here is an example of how a typical report looks like:

The report is divided into two sections: [_**Chart panel**_](#chart-panel) and the [_**Code panel**_](#code-panel). In some situations, the [_**Commits panel**_](#commits-panel) will appear in place of the _code panel_. All three are explained in the sections below.

<box type="info" seamless>

The links to external webpages is only properly supported when RepoSense analyzes a remote repository belonging to GitHub, GitLab or BitBucket.
dcshzj marked this conversation as resolved.
Show resolved Hide resolved
</box>

<!-- ==================================================================================================== -->

## Chart panel
Expand All @@ -62,7 +66,9 @@ The `Chart panel` (an example is shown above) contains a series of _ramp chart_
* The ramp's area is proportional to the amount of contribution the author made at that time period.
* The position of the right edge of the ramp (perpendicular to the blue bar) represents the period (the day or the week) in which the contribution was made.
* Hover the pointer over a ramp to see the total number of lines represented by that ramp.
* Click on the ramp to see on GitHub the list of commits represented by that ramp.
* Click on the ramp to view details about the list of commits represented in the ramp.
* At the commit-level of granularity, it links to the commit in the remote repository.
* At higher levels of granularity, it displays the list of commits in the Code Panel.
* To make the comparison between two authors easier, the color of the ramps that represent different authors' contributions at the same time period are the same.
* Ramps representing big contributions can overlap with earlier time periods. This represents the possibility that if the work committed during a specific period is big, it could have started at an earlier time period.

Expand Down Expand Up @@ -135,8 +141,8 @@ The `Code panel` allows users to see the code attributed to a specific author. C
* Select the checkboxes to include files of preferred file extensions.
The number right beside the file extension shows the total number of lines written by the author in such file extension files. In contrast, the number inside the parenthesis indicates the number of non-blank lines written by the author.
* Clicking the file title toggles the file content.
* Clicking the first icon beside the file title opens the history view of the file on GitHub.
* Clicking the second icon beside the file title opens the blame view of the file on GitHub.
* Clicking the first icon beside the file title opens the history view of the file on the remote repository.
* Clicking the second icon beside the file title opens the blame view of the file on the remote repository.
* Code attributed to the author is highlighted in green.
* Non-trivial code segments that the selected author does not write are hidden by default, but you can toggle them by clicking on the %%:fas-plus-circle:%% icon.

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,12 @@ const app = {
getSpecificCommitLink() {
const version = window.repoSenseVersion;
if (!version) {
return `${window.BASE_URL}/reposense/RepoSense`;
return `${window.REPOSENSE_REPO_URL}`;
}
if (version.startsWith('v')) {
return `${window.BASE_URL}/reposense/RepoSense/releases/tag/${version}`;
return `${window.REPOSENSE_REPO_URL}/releases/tag/${version}`;
}
return `${window.BASE_URL}/reposense/RepoSense/commit/${version}`;
return `${window.REPOSENSE_REPO_URL}/commit/${version}`;
},

getUserGuideLink() {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/v-ramp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default {

methods: {
getLink(commit) {
return `${window.getBaseLink(commit.repoId)}/commit/${commit.hash}`;
return window.getCommitLink(commit.repoId, commit.hash);
},
getWidth(slice) {
if (slice.insertions === 0) {
Expand Down Expand Up @@ -82,7 +82,7 @@ export default {
zTimeFrame: 'commit',
zAvgCommitSize: slice.insertions,
zUser: zoomUser,
zLocation: window.getBaseLink(user.repoId),
zLocation: window.getRepoLink(user.repoId),
zSince: slice.date,
zUntil: this.tframe === 'day' ? slice.date : slice.endDate,
zIsMerged: this.mergegroup,
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/components/v-summary-charts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
span.tooltip-text Click to view group's repo
Copy link
Member

Choose a reason for hiding this comment

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

The icon for this still shows a GitHub logo, might have to find another icon that is more suitable?

Copy link
Contributor Author

@chan-j-d chan-j-d Mar 23, 2022

Choose a reason for hiding this comment

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

😅 I can't think of anything too good. I think the git logo might be fitting for this though I'm unclear on anything related to licensing on this matter. I'll add it so that you can take a look

Copy link
Member

Choose a reason for hiding this comment

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

Hmm the git logo seems weird here, what about fa-file-code or fa-file-lines? Gitlab seems to use the file-lines icon:

Screenshot 2022-03-25 at 18 31 16

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Between the two, I prefer file-code. I'll put forward this suggestion though
image

Since I think it's a pretty common image for remote repositories, especially in images illustrating the forking workflow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated it to fa-file-code, do take a look. Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

@damithc Prof, do you have any thoughts about the icon to use to represent the link to the actual repository? Previously we were using the GitHub logo and it looks like this:
Current

We are currently evaluating the following options to replace this logo so that it is more general and not GitHub-specific:
Database
File code
File lines

Copy link
Collaborator

Choose a reason for hiding this comment

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

For generic icon, perhaps the database one? Also, fontawsome has this icon for git which may be suitable.
image

It would be cool if we can use respective github, gitlab, and bitbucket icons (fontawesome has all three) when we know the repo is one of them, but that can be a separate enhancement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've chosen to settle on the database icon for now. I've tried the git-alt icon and it appears really small on the actual report with the branch lines being barely visible.

This suggestion about the respective icons is really interesting! I think I'll create a new issue for it as I'm not too familiar with how to implement that right now.

a(
v-else-if="filterGroupSelection === 'groupByAuthors'",
v-bind:href="getAuthorProfileLink(repo[0].name)", target="_blank"
v-bind:href="getAuthorProfileLink(repo[0], repo[0].name)", target="_blank"
)
.tooltip
font-awesome-icon.icon-button(icon="user")
Expand Down Expand Up @@ -108,7 +108,7 @@
span.tooltip-text Click to view repo
a(
v-if="filterGroupSelection !== 'groupByAuthors'",
v-bind:href="getAuthorProfileLink(repo[j].name)", target="_blank"
v-bind:href="getAuthorProfileLink(repo[j], repo[j].name)", target="_blank"
)
.tooltip
font-awesome-icon.icon-button(icon="user")
Expand Down Expand Up @@ -301,16 +301,16 @@ export default {
return res;
},

getAuthorProfileLink(userName) {
return `https://github.com/${userName}`;
getAuthorProfileLink(repo, userName) {
return window.getAuthorLink(repo.repoId, userName);
},

getRepoLink(repo) {
const { REPOS } = window;
const { location, branch } = REPOS[repo.repoId];

if (Object.prototype.hasOwnProperty.call(location, 'organization')) {
return `${window.BASE_URL}/${location.organization}/${location.repoName}/tree/${branch}`;
return window.getBranchLink(repo.repoId, branch);
}
this.removeSelectedTab();
return repo.location;
Expand Down
55 changes: 50 additions & 5 deletions frontend/src/utils/api.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// utility functions //
window.$ = (id) => document.getElementById(id);
window.enquery = (key, val) => `${key}=${encodeURIComponent(val)}`;
window.BASE_URL = 'https://github.com';
window.REPOSENSE_REPO_URL = 'https://github.com/reposense/RepoSense';
window.HOME_PAGE_URL = 'https://reposense.org';
window.UNSUPPORTED_INDICATOR = 'UNSUPPORTED';
dcshzj marked this conversation as resolved.
Show resolved Hide resolved
window.DAY_IN_MS = (1000 * 60 * 60 * 24);
window.HASH_DELIMITER = '~';
window.REPOS = {};
Expand Down Expand Up @@ -120,10 +121,52 @@ window.toggleNext = function toggleNext(ele) {
parent.className = classes.join(' ');
};

window.getBaseLink = function getBaseLink(repoId) {
return `${window.BASE_URL}/${
window.REPOS[repoId].location.organization}/${
window.REPOS[repoId].location.repoName}`;
window.filterUnsupported = function filterUnsupported(string) {
// checks for a pre-defined unsupported tag
return string.includes(window.UNSUPPORTED_INDICATOR) ? undefined : string;
};

window.getAuthorLink = function getAuthorLink(repoId, author) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice use of abstraction

const domainName = window.REPOS[repoId].location.domainName;
return window.filterUnsupported(window.DOMAIN_URL_MAP[domainName].BASE_URL + author);
};

window.getRepoLinkUnfiltered = function getRepoLink(repoId) {
// abstraction for repo link construction. Not supposed to be used by other files
const domainName = window.REPOS[repoId].location.domainName;
return window.DOMAIN_URL_MAP[domainName].REPO_URL
.replace('ORGANIZATION', window.REPOS[repoId].location.organization)
.replace('REPO_NAME', window.REPOS[repoId].location.repoName);
dcshzj marked this conversation as resolved.
Show resolved Hide resolved
};

window.getRepoLink = function getRepoLink(repoId) {
return window.filterUnsupported(window.getRepoLinkUnfiltered(repoId));
};

window.getBranchLink = function getBranchLink(repoId, branch) {
const domainName = window.REPOS[repoId].location.domainName;
return window.filterUnsupported(window.getRepoLinkUnfiltered(repoId) + window.DOMAIN_URL_MAP[domainName].BRANCH
.replace('BRANCH', branch));
};

window.getCommitLink = function getCommitLink(repoId, commitHash) {
const domainName = window.REPOS[repoId].location.domainName;
return window.filterUnsupported(window.getRepoLinkUnfiltered(repoId) + window.DOMAIN_URL_MAP[domainName].COMMIT_PATH
.replace('COMMIT_HASH', commitHash));
};

window.getBlameLink = function getBlameLink(repoId, branch, filepath) {
const domainName = window.REPOS[repoId].location.domainName;
return window.filterUnsupported(window.getRepoLinkUnfiltered(repoId) + window.DOMAIN_URL_MAP[domainName].BLAME_PATH
.replace('BRANCH', branch)
.replace('FILE_PATH', filepath));
};

window.getHistoryLink = function getHistoryLink(repoId, branch, filepath) {
const domainName = window.REPOS[repoId].location.domainName;
return window.filterUnsupported(window.getRepoLinkUnfiltered(repoId) + window.DOMAIN_URL_MAP[domainName].HISTORY_PATH
.replace('BRANCH', branch)
.replace('FILE_PATH', filepath));
};

window.getGroupName = function getGroupName(group, filterGroupSelection) {
Expand Down Expand Up @@ -190,6 +233,8 @@ window.api = {
errorMessages[repoName] = message;
});

window.DOMAIN_URL_MAP = data.supportedDomainUrlMap;

const names = [];
data.repos.forEach((repo) => {
const repoName = `${repo.displayName}`;
Expand Down
13 changes: 8 additions & 5 deletions frontend/src/views/v-authorship.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@
span {{ i + 1 }}. &nbsp;&nbsp; {{ file.path }} &nbsp;
span.icons
a(
v-bind:href="getFileLink(file, 'commits')", target="_blank"
v-bind:href="getHistoryLink(file)", target="_blank"
)
.tooltip
font-awesome-icon.button(icon="history")
span.tooltip-text Click to view the history view of file
a(
v-if='!file.isBinary',
v-bind:href="getFileLink(file, 'blame')", target="_blank",
v-bind:href="getBlameLink(file)", target="_blank",
title="click to view the blame view of file"
)
.tooltip
Expand Down Expand Up @@ -525,11 +525,14 @@ export default {
this.updateFileTypeHash();
},

getFileLink(file, path) {
getHistoryLink(file) {
const repo = window.REPOS[this.info.repo];
return window.getHistoryLink(this.info.repo, repo.branch, file.path);
},

return `${window.BASE_URL}/${
repo.location.organization}/${repo.location.repoName}/${path}/${repo.branch}/${file.path}`;
getBlameLink(file) {
const repo = window.REPOS[this.info.repo];
return window.getBlameLink(this.info.repo, repo.branch, file.path);
},

getFileTypeBlankLineInfo(fileType) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/v-summary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export default {

// view functions //
getReportIssueGitHubLink(stackTrace) {
return `${window.BASE_URL}/reposense/RepoSense/issues/new?title=${this.getReportIssueTitle()
return `${window.REPOSENSE_REPO_URL}/issues/new?title=${this.getReportIssueTitle()
}&body=${this.getReportIssueMessage(stackTrace)}`;
},

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/views/v-zoom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ export default {

getSliceLink(slice) {
if (this.info.zIsMerged) {
return `${window.getBaseLink(slice.repoId)}/commit/${slice.hash}`;
return window.getCommitLink(slice.repoId, slice.hash);
}
return `${window.getBaseLink(this.info.zUser.repoId)}/commit/${slice.hash}`;
return window.getCommitLink(this.info.zUser.repoId, slice.hash);
},

scrollToCommit(tag, commit) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/reposense/authorship/FileInfoExtractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public static Set<Path> getFiles(RepoConfiguration repoConfig, boolean isBinaryF
return modifiedFileList.stream()
.filter(file -> isBinaryFile == file.startsWith(BINARY_FILE_LINE_DIFF_RESULT))
.map(file -> file.split("\t")[2])
.filter(FileUtil::isValidPath)
.filter(FileUtil::isValidPathWithLogging)
.map(filteredFile -> Paths.get(filteredFile))
.collect(Collectors.toCollection(HashSet::new));
}
Expand Down Expand Up @@ -245,7 +245,7 @@ private static int getStartingLineNumber(String linesChanged) {
private static boolean isValidTextFile(String filePath, Set<Path> textFilesSet) {
boolean isValidFilePath;
try {
isValidFilePath = FileUtil.isValidPath(filePath);
isValidFilePath = FileUtil.isValidPathWithLogging(filePath);
} catch (InvalidPathException ipe) {
logger.log(Level.WARNING, String.format(MESSAGE_INVALID_FILE_PATH, filePath));
isValidFilePath = false;
Expand Down
Loading