Skip to content

Commit

Permalink
Merge branch 'master' into 2184-line-colors
Browse files Browse the repository at this point in the history
  • Loading branch information
sopa301 authored Apr 20, 2024
2 parents eebfc9c + 3c53d58 commit 7bccaad
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 34 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ def syncFrontendPublic = tasks.register('syncFrontendPublic', Sync) {
preserve {
include 'index.html'
include 'favicon.ico'
include 'title.md'
}
}

Expand Down
2 changes: 1 addition & 1 deletion docs/_markbind/layouts/ug-sitenav.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{name: "Appendices"},
{level: 2, name: "CLI syntax reference", link: "ug/cli.html"},
{level: 2, name: "Config files format", link: "ug/configFiles.html"},
{level: 2, name: "Advanced syntax: `author-config.csv`", link: "ug/authorConfigSyntax.html"},
{level: 2, name: "Advanced syntax: `author-config.csv`", link: "ug/authorConfigSyntax.html"},
{level: 2, name: "Using `@@author` tags", link: "ug/usingAuthorTags.html"},
{level: 2, name: "RepoSense with Netlify", link: "ug/withNetlify.html"},
{level: 2, name: "RepoSense with GitHub Actions", link: "ug/withGithubActions.html"},
Expand Down
2 changes: 1 addition & 1 deletion docs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Contributor [2023 January - 2024 January]<br/>
<!-- ------------------------------------------------------------------------------------------------------ -->

### [Gokul Rajiv](https://github.com/gok99)
**Role**: Senior Developer [2024 January - ]<br/>
**Role**: Senior Developer [2024 January - ]<br/>
Contributor [2022 January - 2024 January]<br/>

<!-- ------------------------------------------------------------------------------------------------------ -->
Expand Down
Binary file added docs/images/title-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/ug/authorConfigSyntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div class="lead">

Given below are the advanced syntax available for `author-config.csv`.
Given below are the advanced syntax available for `author-config.csv`.
</div>

## Multiple `Repository's Location` per author
Expand Down
3 changes: 1 addition & 2 deletions docs/ug/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ 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,
while a `title.md` file can be placed to customize the header of the report using [Markdown syntax](https://www.markdownguide.org/basic-syntax/).
* 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 [title](https://reposense.org/ug/customizingReports.html#add-a-title) of the report using [Markdown syntax](https://www.markdownguide.org/basic-syntax/).
* Alias: `-a`
* Example: `--assets ./assets` or `-a ./assets`

Expand Down
14 changes: 14 additions & 0 deletions docs/ug/customizingReports.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,17 @@ In both instances, it is **necessary to commit any changes** for them to be dete
</box>

3\. Add a git `.mailmap` file at the top-level of the repository, specifying mapped authors/commiters and/or e-mail addresses as per [gitmailmap documentation](https://git-scm.com/docs/gitmailmap). Any mappings specified here will be applied by git before all other RepoSense configurations. Configuration via `.mailmap` is particularly useful if you want the mapping to apply for all git commands as well instead of just for RepoSense.

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

### Add a title

A title component can be added by creating a file titled `title.md` in the assets directory. You can specify the assets directory according to the reference below:
{{ embed("Appendix: **CLI syntax reference → `assets` flag**", "cli.md#section-assets") }}

The title can render a combination of Markdown/HTML and plaintext ([example](https://github.com/reposense/RepoSense/blob/master/docs/ug/title.md)), and will appear on the top of the left panel as shown below:
![Title Component Example](../images/title-example.png)

Do note that the width of the title is bound by the width of the left panel.

For more information on how to use Markdown, see the [Markdown Guide](https://www.markdownguide.org/).
9 changes: 9 additions & 0 deletions docs/ug/title.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# RepoSense

RepoSense is a powerful tool for analyzing repositories. It provides valuable insights into your codebase, helping you understand the development patterns, identify areas for improvement, and track the contributions of individual team members.

## Features

- Repository analysis: Gain a comprehensive overview of your codebase, including commit statistics, file changes, and code ownership.
- Contribution tracking: Easily track the contributions made by each team member, including the number of commits, lines of code added/removed, and more.
- Visualization: Visualize your repository's history and changes over time through interactive graphs and charts.
2 changes: 1 addition & 1 deletion docs/ug/usingReports.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ The `Code panel` allows users to see the code attributed to a specific author. C
* Clicking the file title toggles the file content.
* 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.
* When using the code panel for a specific author, code attributed to the author is highlighted in green.
* When using the code panel for a specific author, code attributed to the author is highlighted in green.
* When using the `merge group` option with `group by repos`, the code panel will consist of multiple authors' contributions. Code attributed to these authors can be differentiated by the highlight colors of the code. The color legend is shown at the top of each file and consists only those authors that edited a particular file.
* Non-trivial code segments that the selected author has not written are hidden by default, but you can toggle them by clicking on the %%:fas-plus-circle:%% icon.

Expand Down
3 changes: 3 additions & 0 deletions frontend/cypress/config/repo-config.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ https://github.com/reposense/testrepo-Empty2.git,master,,,,,,,
https://github.com/reposense/testrepo-Empty3.git,master,,,,,,,
https://github.com/reposense/testrepo-Empty4.git,master,,,,,,,
https://github.com/reposense/testrepo-Empty5.git,master,,,,,,,
https://github.com/reposense/publish-RepoSense.git,master,,,,,,,
https://github.com/reposense/repoSense-action.git,main,,,,,,,
https://github.com/reposense/RepoSense-auth-helper.git,master,,,,,,,
34 changes: 15 additions & 19 deletions frontend/cypress/tests/chartView/chartView_mergeGroup.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ describe('merge group', () => {
.check()
.should('be.checked');

// after checking merge group, only one merged repo group will show
// after checking merge group, only four merged repo groups will show
cy.get('#summary-charts').find('.summary-chart')
.should('have.length', 1);
.should('have.length', 4);

cy.get('#summary label.merge-group > input:visible')
.should('be.visible')
.uncheck()
.should('not.be.checked');

// after un-checking merge group, all 5 summary charts will show
// after un-checking merge group, all 14 summary charts will show
cy.get('#summary-charts').find('.summary-chart')
.should('have.length', 5);
.should('have.length', 14);
});

it('check and uncheck merge group when group by authors', () => {
Expand All @@ -31,19 +31,19 @@ describe('merge group', () => {
.check()
.should('be.checked');

// after checking merge group, 5 merged author groups will show
// after checking merge group, 14 merged author groups will show
cy.get('#summary-charts').find('.summary-chart')
.should('have.length', 5);
.should('have.length', 14);

cy.get('#summary label.merge-group > input:visible')
.first()
.should('be.visible')
.uncheck()
.should('not.be.checked');

// after un-checking merge group, all 5 summary charts will show
// after un-checking merge group, all 14 summary charts will show
cy.get('#summary-charts').find('.summary-chart')
.should('have.length', 5);
.should('have.length', 14);
});

it('merge group option should be disabled when group by none', () => {
Expand All @@ -56,26 +56,22 @@ describe('merge group', () => {
});

it('should have the correct number of merge group contribution bars and correct length', () => {
// Assumption: The number of merge group contribution bars is 3 and the width of the third bar is 50%.
cy.get('#summary label.merge-group > input:visible')
.should('be.visible')
.check()
.should('be.checked');

// get the three chart bars and assert they have the correct initial widths
// get the chart bars and assert they have the correct initial widths
const expectedWidths = [100, 100, 100, 15, 100, 100, 90, 30, 15];
cy.get('.stacked-bar__contrib--bar')
.should('have.length', 3)
.should('have.length', expectedWidths.length)
.then(($bars) => {
// calculate the percentage of the width relative to the parent container
const parentWidth = $bars.eq(0).parent().width();
const width1 = (parseFloat(window.getComputedStyle($bars[0]).width) / parentWidth) * 100;
const width2 = (parseFloat(window.getComputedStyle($bars[1]).width) / parentWidth) * 100;
const width3 = (parseFloat(window.getComputedStyle($bars[2]).width) / parentWidth) * 100;

// assert that the widths are close enough to 100% and 50%
expect(width1).to.be.closeTo(100, 1);
expect(width2).to.be.closeTo(100, 1);
expect(width3).to.be.closeTo(50, 1);
expectedWidths.forEach((expectedWidth, index) => {
const width = (parseFloat(window.getComputedStyle($bars[index]).width) / parentWidth) * 100;
expect(width).to.be.closeTo(expectedWidth, 1);
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ describe('scroll to active repo', () => {
});

cy.url()
.should('contain', 'tabAuthor=yong24s')
.should('contain', 'tabRepo=reposense%2FRepoSense%5Bcypress%5D');
.should('contain', 'tabAuthor=Yong%20Hao%20TENG')
.should('contain', 'tabRepo=reposense%2Fpublish-RepoSense%5Bmaster%5D');

cy.reload();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('search bar', () => {
it('unique author shows one result', () => {
cy.get('#app #tab-resize .tab-close').click();
cy.get('#summary-wrapper input[type=text]')
.type('Yong Hao TENG')
.type('Metta')
.type('{enter}');

cy.get('#summary-wrapper form.summary-picker')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('switch authorship', () => {
// switch authorship view
cy.get('.icon-button.fa-code')
.should('exist')
.last()
.eq(4)
.click();

// check default controls
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/tests/zoomView/zoomView_switchZoom.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('switch zoom', () => {
// switch zoom view
cy.get('.icon-button.fa-list-ul')
.should('exist')
.last()
.eq(4)
.click();

cy.get('#tabs-wrapper').scrollTo('top');
Expand Down
3 changes: 3 additions & 0 deletions frontend/public/title.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# RepoSense

RepoSense is a powerful tool for analyzing repositories. It provides valuable insights into your codebase, helping you understand the development patterns, identify areas for improvement, and track the contributions of individual team members.
10 changes: 6 additions & 4 deletions frontend/src/components/c-summary-charts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
)
| [{{ getGroupTotalContribution(repo) }} lines]
span.tooltip-text(
v-if="filterGroupSelection === 'groupByRepos' && !isChartGroupWidgetMode"
)(v-bind:ref="`summary-charts-${i}-total-contribution`") Total contribution of group
v-if="filterGroupSelection === 'groupByRepos' && !isChartGroupWidgetMode",
v-bind:ref="`summary-charts-${i}-total-contribution`"
) Total contribution of group
span.tooltip-text(
v-else-if="filterGroupSelection === 'groupByAuthors' && !isChartGroupWidgetMode"
)(v-bind:ref="`summary-charts-${i}-total-contribution`") Total contribution of author
v-else-if="filterGroupSelection === 'groupByAuthors' && !isChartGroupWidgetMode",
v-bind:ref="`summary-charts-${i}-total-contribution`"
) Total contribution of author
a(
v-if="!isGroupMerged(getGroupName(repo)) && !isChartGroupWidgetMode",
v-on:click="handleMergeGroup(getGroupName(repo))"
Expand Down

0 comments on commit 7bccaad

Please sign in to comment.