Skip to content

Commit

Permalink
Merge branch 'master' into feature/increase-cypress-timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
chan-j-d committed Aug 2, 2023
2 parents 826d43c + 1d20634 commit 59940e1
Show file tree
Hide file tree
Showing 17 changed files with 315 additions and 80 deletions.
12 changes: 12 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@
ORDER CHECKS
-->

<!-- Checks that the default is after all the cases in a switch statement. -->
<module name="DefaultComesLast"/>

<!-- Checks that the order of at-clauses follows the tagOrder default property value order.
@author, @version, @param, @return, @throws, @exception, @see, @since, @serial, @serialField, @serialData, @deprecated
-->
Expand Down Expand Up @@ -245,6 +248,9 @@
WHITESPACE CHECKS
-->

<!-- Checks that there is no whitespace before the colon in a switch block. -->
<module name="NoWhitespaceBeforeCaseDefaultColon"/>

<!-- Checks that comments are indented relative to their position in the code -->
<module name="CommentsIndentation"/>

Expand Down Expand Up @@ -358,6 +364,12 @@
<!-- Checks that all Javadoc comments start from the second line. -->
<module name="JavadocContentLocationCheck" />

<!-- Checks the indentation of the continuation lines in block tags. -->
<module name="JavadocTagContinuationIndentation">
<property name="offset" value="0"/>
<property name="violateExecutionOnNonTightHtml" value="true"/>
</module>

<!-- Checks the Javadoc's format for every method (excluding getters, setters and constructors). -->
<module name="JavadocMethod">
<property name="allowMissingParamTags" value="true"/>
Expand Down
3 changes: 2 additions & 1 deletion docs/ug/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The section below provides explanations for each of the flags.

### `--assets`, `-a`

<div id="section-config">
<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.
Expand Down Expand Up @@ -56,6 +56,7 @@ The section below provides explanations for each of the flags.

* Cannot be used with `--repos`. The `--repos` flag will take precedence over this flag.
* If both `--repos` and `--config` are not specified, RepoSense looks for config files in the `./config` directory.
* Config files must follow [this](./configFiles.html) format.
</box>
</div>

Expand Down
4 changes: 2 additions & 2 deletions docs/ug/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ To enable *RepoSense* to work on private repositories, ensure that you have enab

### Q: How do formats work?
**A:** **Formats** are the [file extensions](https://techterms.com/definition/fileextension), which is the **suffix** at the end of a filename that indicates what type of file it is.<br>
The formats/file extensions to be analyzed by *RepoSense* can be specified through the [standalone config file](#provide-data-using-a-json-config-file), [repo-config file](#repo-configcsv), and [command line](#customize-using-command-line-parameters).
The formats/file extensions to be analyzed by *RepoSense* can be specified through the [standalone config file](./configFiles.md#config-json-standalone-config-file), [repo-config file](./configFiles.md#repo-config-csv), and [command line](./cli.md#formats-f).

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

### Q: How does ignore glob list work?
**A:** [Glob](https://en.wikipedia.org/wiki/Glob_(programming)) is the pattern to specify a set of filenames with [wildcard characters](https://www.computerhope.com/jargon/w/wildcard.htm). **Ignore glob list** is the list of patterns to specify all the files in the repository which should be ignored from analysis.<br>
The ignore glob list can be specified through the [standalone config file](#provide-data-using-a-json-config-file), [repo-config file](#repo-config-csv), and [author-config file](#author-config-csv).
The ignore glob list can be specified through the [standalone config file](./configFiles.md#config-json-standalone-config-file), [repo-config file](./configFiles.md#repo-config-csv), and [author-config file](./configFiles.md#author-config-csv).
File renamed without changes.
8 changes: 4 additions & 4 deletions docs/ug/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

### 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](#author-config-csv).<br>
Please refer to [A Note About Git Author Name](#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>
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>
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](#provide-data-using-a-json-config-file) or [author-config file](#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 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).


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

### Contribution bar and code panel is empty (despite a non-empty ramp chart)

The contribution bar and code panel records the lines you have authored to the **latest** commit of the repository and branch you are analyzing. As such, it is possible that while you have lots of committed contributions, your final authorship contribution is low. This happens if you have only deleted lines or someone else has overwritten your code and taken authorship for it (currently, RepoSense does not have the functionality to track overwritten lines).<br>
It is also possible that another user has overridden the authorship of your lines using the [@@author tags](#provide-data-using-author-tags).
It is also possible that another user has overridden the authorship of your lines using the [@@author tags](./usingAuthorTags.md#appendix-using-author-tags).

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

Expand Down
4 changes: 2 additions & 2 deletions docs/ug/withTravis.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ The instructions below assume you are using GitHub pages to host your report.

{{ step(2)}} **Generate a _personal access token_ or _deploy key_ on GitHub** as explained in the panel below.

{{ embed("Granting write access on GitHub", "grantingWriteAccess.mbdf") }}
{{ embed("Granting write access on GitHub", "grantingWriteAccess.md") }}

{{ step(3) }} **Login to [Travis-CI](https://travis-ci.org/).** You may have to sign up first.

{{ step(4) }} **Syncy your Travis account with GitHub:**
{{ step(4) }} **Sync your Travis account with GitHub:**

1. Go to [your account](https://travis-ci.org/account/repositories).
1. Click on `Sync account` to fetch all your repositories into Travis-CI.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe('contribution bar', () => {
it('same length when breakdown selected', () => {
let expectedWidthSum = 0;
cy.get('.summary-chart__contrib--bar').then((ele) => {
cy.get('.stacked-bar__contrib--bar').then((ele) => {
let i;
for (i = 0; i < ele.length; i += 1) {
expectedWidthSum += parseFloat(ele[i].style.width.split('%')[0]);
Expand All @@ -12,7 +12,7 @@ describe('contribution bar', () => {
.check();

let actualWidthSum = 0;
cy.get('.summary-chart__contrib--bar').then((ele) => {
cy.get('.stacked-bar__contrib--bar').then((ele) => {
let i;
for (i = 0; i < ele.length; i += 1) {
actualWidthSum += parseFloat(ele[i].style.width.split('%')[0]);
Expand All @@ -35,7 +35,7 @@ describe('contribution bar', () => {
let expectedWidthSum = 0;
cy.get('#summary-wrapper label').contains('breakdown by file type').siblings().filter('input')
.check();
cy.get('.summary-chart__contrib--bar').then((ele) => {
cy.get('.stacked-bar__contrib--bar').then((ele) => {
expectedWidthSum += parseFloat(ele[0].style.width.split('%')[0]);
});

Expand All @@ -46,7 +46,7 @@ describe('contribution bar', () => {
.check();

let actualWidthSum = 0;
cy.get('.summary-chart__contrib--bar').then((ele) => {
cy.get('.stacked-bar__contrib--bar').then((ele) => {
let i;
for (i = 0; i < ele.length; i += 1) {
actualWidthSum += parseFloat(ele[i].style.width.split('%')[0]);
Expand Down
6 changes: 3 additions & 3 deletions frontend/cypress/tests/chartView/chartView_mergeGroup.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('merge group', () => {
.should('be.checked');

// get the three chart bars and assert they have the correct initial widths
cy.get('.summary-chart__contrib--bar')
cy.get('.stacked-bar__contrib--bar')
.should('have.length', 3)
.then(($bars) => {
// calculate the percentage of the width relative to the parent container
Expand All @@ -88,7 +88,7 @@ describe('merge group', () => {
const initialWidths = [];

// Store the initial widths of the contribution bars
cy.get('.summary-chart__contrib--bar')
cy.get('.stacked-bar__contrib--bar')
.each(($bar) => {
const width = window.getComputedStyle($bar[0]).width;
initialWidths.push(width);
Expand All @@ -99,7 +99,7 @@ describe('merge group', () => {
cy.get('.overlay-loader').should('not.be.visible');

// Get the contribution bars again and compare their widths with the initial widths
cy.get('.summary-chart__contrib--bar')
cy.get('.stacked-bar__contrib--bar')
.should('have.length', initialWidths.length)
.each(($bar, index) => {
const width = window.getComputedStyle($bar[0]).width;
Expand Down
93 changes: 93 additions & 0 deletions frontend/cypress/tests/zoomView/zoomView_diffstat.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
describe('diffstat', () => {
it('should render container for contribution bars', () => {
cy.get('.icon-button.fa-list-ul')
.should('be.visible')
.first()
.click();

cy.get('#tab-zoom .commit-message .stacked-bar-container')
.should('be.visible');
});

// Assumptions: The commit selected here is @eugenepeh's
// `README: Fix grammatical error` with 1 insertion and 1 deletion.
it('should render non-empty contribution bars for commits with changes', () => {
cy.get('.icon-button.fa-list-ul')
.should('be.visible')
.first()
.click();

cy.get('#tab-zoom .commit-message')
.first()
.within(() => {
cy.get('.stacked-bar__contrib--bar')
.then((element) => {
expect(element.length).to.be.equal(2);
expect(element[0].style['background-color']).to.be.equal('limegreen');
expect(element[0].style.width).to.be.equal('0.1%');
expect(element[1].style['background-color']).to.be.equal('red');
expect(element[1].style.width).to.be.equal('0.1%');
});
});
});

// Assumptions: The commit selected here is @eugenepeh's
// `Merge branch 'new-branch` into cypress` with 0 insertions and 0 deletions.
it('should render empty contribution bars for commits with no changes', () => {
cy.get('.icon-button.fa-list-ul')
.should('be.visible')
.first()
.click();

cy.get('#tab-zoom .commit-message')
.eq(1)
.within(() => {
cy.get('.stacked-bar__contrib--bar')
.then((element) => {
expect(element.length).to.be.equal(2);
expect(element[0].style['background-color']).to.be.equal('limegreen');
expect(element[0].style.width).to.be.equal('0%');
expect(element[1].style['background-color']).to.be.equal('red');
expect(element[1].style.width).to.be.equal('0%');
});
});
});

it('should render contribution bars in proportion', () => {
cy.get('.icon-button.fa-list-ul')
.should('be.visible')
.first()
.click();

let insertionWidthSum = 0;
let deletionWidthSum = 0;
let widthProportion = 0;
cy.get('#tab-zoom .commit-message .stacked-bar__contrib--bar')
.then((element) => {
for (let i = 0; i < element.length; i += 1) {
const val = parseFloat(element[i].style.width.split('%')[0]);
if (element[i].style['background-color'] === 'limegreen') {
insertionWidthSum += val;
} else {
deletionWidthSum += val;
}
}
widthProportion = insertionWidthSum / deletionWidthSum;
});

let insertions = 0;
let deletions = 0;
let actualProportion = 0;
cy.get('[data-cy="changes"]')
.invoke('text')
.then((text) => {
const temp = text.split('lines');
for (let i = 0; i < temp.length - 1; i += 1) {
insertions += parseFloat(temp[i].split('-')[0].split('+')[1].trim());
deletions += parseFloat(temp[i].split('-')[1].trim());
}
actualProportion = insertions / deletions;
expect(widthProportion.toFixed(3)).to.be.equal(actualProportion.toFixed(3));
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('hide all commit messages ', () => {
.should('have.length', 1);

cy.get('#tab-zoom .toolbar--multiline > a')
.should('have.text', 'hide all commit messages');
.should('have.text', 'hide all commit details');
});

it('should only display show all commit messages when all are hidden', () => {
Expand All @@ -93,7 +93,7 @@ describe('hide all commit messages ', () => {
.should('have.length', 1);

cy.get('#tab-zoom .toolbar--multiline > a')
.should('have.text', 'show all commit messages');
.should('have.text', 'show all commit details');
});

it('should display both show and hide all commit messages when some are hidden', () => {
Expand All @@ -119,11 +119,11 @@ describe('hide all commit messages ', () => {

cy.get('#tab-zoom .toolbar--multiline > a')
.eq(0)
.should('have.text', 'show all commit messages');
.should('have.text', 'show all commit details');

cy.get('#tab-zoom .toolbar--multiline > a')
.eq(1)
.should('have.text', 'hide all commit messages');
.should('have.text', 'hide all commit details');
});

it('check show all and hide all commit messages only toggle current commits', () => {
Expand Down Expand Up @@ -152,7 +152,7 @@ describe('hide all commit messages ', () => {
.should('have.length', 1);

cy.get('#tab-zoom .toolbar--multiline > a')
.should('have.text', 'show all commit messages');
.should('have.text', 'show all commit details');

// check java file type
cy.get('#tab-zoom .fileTypes input[value="java"]')
Expand Down Expand Up @@ -182,11 +182,11 @@ describe('hide all commit messages ', () => {

cy.get('#tab-zoom .toolbar--multiline > a')
.eq(0)
.should('have.text', 'show all commit messages');
.should('have.text', 'show all commit details');

cy.get('#tab-zoom .toolbar--multiline > a')
.eq(1)
.should('have.text', 'hide all commit messages');
.should('have.text', 'hide all commit details');
});

it('check hidden commit message persists after sort', () => {
Expand Down
39 changes: 39 additions & 0 deletions frontend/src/components/c-stacked-bar-chart.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template lang="pug">
.stacked-bar-container
.stacked-bar__contrib--bar(
v-for="bar in bars",
v-bind:title="bar.tooltipText",
v-bind:style="{ width: `${bar.width}%`,\
'background-color': bar.color }"
)
</template>

<script lang="ts">
import { PropType, defineComponent } from 'vue';
import { Bar } from '../types/types';
export default defineComponent({
props: {
bars: {
type: Array as PropType<Bar[]>,
required: true,
},
},
});
</script>

<style scoped lang="scss">
@import '../styles/_colors.scss';
.stacked-bar-container {
display: flex;
flex-wrap: wrap;
}
.stacked-bar__contrib--bar {
background-color: mui-color('blue');
height: 4px;
margin-top: 2px;
}
</style>
Loading

0 comments on commit 59940e1

Please sign in to comment.