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 analyze authorship #2147

Closed

Conversation

SkyBlaise99
Copy link
Contributor

Fixes #944

Proposed commit message

Currently, a line is credited to the author who last modified it.

Another author might have written the line initially and the current
author only modified it slightly. In such a case, the current author
gets credited for work that is not entirely done by him/her.

Let's analyze how similar a line is as compared to its ancestor lines
(previous versions of the line) and give full or partial credit to the
last author based on the analysis.

Other information

Changes in Frontend

  1. added a new entry: isFullCredit to be read from json file.
  2. a darker colour represents full credit while a lighter colour represents partial credit.

Changes in Backend

  1. added 2 new flags:
  • --analyze-authorship or -A to enable the feature
    • initially added as the program takes too long to run, can be removed now since runtime decreased by a lot.
  • --originality-threshold or -ot to manually set the threshold
    • acceptable range: 0.0 ~ 1.0
    • default 0.51
    • rational: the last author need to modify slightly more than half the line to be given full credit.
  1. added AuthorshipAnalyzer
  • main logic:
    1. given a line l, author a
    2. find previous version of l, the deleted lines with the lowest originality score (same idea as highest similarity score)
    3. Give full credit if
      • there are no deleted lines found
      • deleted line's originality score is more than the originality threshold
      • author of the deleted line is unknown
      • deleted line is before since date, is in ignored list, or is an ignored file
    4. Give partial credit if currentAuthor is not the author of the previous version
    5. Else restart from step 1 with the deleted line
  • improvements made: (runtime decreased from 1h 30 min to 13 min)
    1. added caching for git log and git diff
    2. added early termination for DP getLevenshteinDistance()
    3. reduce space compleity of DP getLevenshteinDistance()
  1. updated AnnotatorAnalyzer to handle overwriting of credit information
  • case 1: blame author == annotated author
    do nothing since it's the same author, credit information is retained.
  • case 2: blame author != annotated author
    overwrite author as usual, partial credit is given to annotated author as we are not sure the exact contribution since it is claimed.

SkyBlaise99 and others added 28 commits September 1, 2023 11:58
getDeletedLineWithHighestSimilarityInDiff returning null
# Conflicts:
#	frontend/cypress/tests/chartView/chartView_zoomFeature.cy.js
#	frontend/src/views/c-authorship.vue
This reverts commit 950c912, reversing
changes made to 4bd05a7.
Currently frontend tests are failing.
Let's sync with master branch to fix the test cases.
…uthor (reposense#2060)

AnnotatorAnalyzer only overwrites the author but not the credit
information, when an author tag is found. If the analyze authorship
flag is enabled, credit information based on the blame author will be
wrongly inherited by the annotated author.

Lets assign partial credit if the annotated author is not the same as
the blame author, and keep the analyzed credit information if the 2
are the same.
…posense#2070)

* [reposense#2027] Fix date range bug (reposense#2034)

Currently, users are unable to select a zoom range that includes 
the until date.

This results in misleading data being presented to users.

* [reposense#2039] Update cypress minimum requirement to 12.15.0 (reposense#2041)

Chrome bug is causing cypress to fail to open a browser on Github 
Actions, causing frontend tests and CI to fail. Upgrading cypress 
to greater than 12.15.0 will fix this issue.

Let's upgrade cypress to fix the failing CI.

* [reposense#1936] Migrate c-segment.vue to typescript (reposense#2035)

Currently, there is still some JavaScript code which remains 
unmigrated. This allows for type unsafe code to be written, 
potentially resulting in unintended behavior.

Let's migrate the rest of the JavaScript code to TypeScript 
code to facilitate future changes to the code.

* [reposense#1936] Migrate load-font-awesome-icons.js to typescript (reposense#2040)

Currently, there is still some JavaScript code which remains 
unmigrated. This allows for type unsafe code to be written, 
potentially resulting in unintended behavior.

Let's migrate the rest of the JavaScript code to TypeScript 
code to facilitate future changes to the code.

* [reposense#2045] Fix cypress zoom feature test (reposense#2047)

Currently, Cypress zoom feature tests are failing due to a recent change
in behavior caused by a bug fix. With the tests failing, we are unable
to detect any future regressions.

Let's update the Cypress tests to test for the new intended behavior.

* [reposense#1936] Migrate random-color-gen.js to typescript (reposense#2043)

Currently, there is still some JavaScript code which remains unmigrated.
This allows for type unsafe code to be written, potentially resulting in
unintended behavior.

Let's migrate random-color-generator.js JavaScript code to TypeScript
code to facilitate future changes to the code.

* [reposense#1936] Migrate c-segment-collection.vue to typescript (reposense#2036)

Currently, there is still some JavaScript code which remains unmigrated.
This allows for type unsafe code to be written, potentially resulting in
unintended behavior.

Let's migrate the rest of the JavaScript code to TypeScript code to
facilitate future changes to the code.

* [reposense#1936] Migrate c-resizer.vue to typescript (reposense#2038)

Currently, there is still some JavaScript code which remains unmigrated.
This allows for type unsafe code to be written, potentially resulting in
unintended behavior.

Let's migrate the rest of the JavaScript code to TypeScript code to
facilitate future changes to the code.

* Bump zod from 3.20.6 to 3.22.3 in /frontend (reposense#2048)

Bumps [zod](https://github.com/colinhacks/zod) from 3.20.6 to 3.22.3.
- [Release notes](https://github.com/colinhacks/zod/releases)
- [Changelog](https://github.com/colinhacks/zod/blob/master/CHANGELOG.md)
- [Commits](colinhacks/zod@v3.20.6...v3.22.3)

---
updated-dependencies:
- dependency-name: zod
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @cypress/request and cypress in /frontend/cypress (reposense#2042)

Bumps [@cypress/request](https://github.com/cypress-io/request) to 3.0.1 and updates ancestor dependency [cypress](https://github.com/cypress-io/cypress). These dependencies need to be updated together.


Updates `@cypress/request` from 2.88.12 to 3.0.1
- [Release notes](https://github.com/cypress-io/request/releases)
- [Changelog](https://github.com/cypress-io/request/blob/master/CHANGELOG.md)
- [Commits](cypress-io/request@v2.88.12...v3.0.1)

Updates `cypress` from 12.17.4 to 13.3.0
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/CHANGELOG.md)
- [Commits](cypress-io/cypress@v12.17.4...v13.3.0)

---
updated-dependencies:
- dependency-name: "@cypress/request"
  dependency-type: indirect
- dependency-name: cypress
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [reposense#1936] Migrate c-ramp.vue to typescript (reposense#2037)

Currently, there is still some JavaScript code which remains unmigrated.
This allows for type unsafe code to be written, potentially resulting in
unintended behavior.

Let's migrate the rest of the JavaScript code to TypeScript code to
facilitate future changes to the code.

* Give partial credit if annotated author is not the same as the blame
author

* [reposense#2054] Fix zoom view bug (reposense#2055)

Currently, when granularity is set to day or week, clicking on a ramp
will open up a zoom view where commit messages are not being displayed
and sorting by insertions does not result in any sorting. 

Let's fix the unintended behaviour of the zoom view.

* [reposense#1936] Migrate repo-sorter.js to typescript (reposense#2052)

Currently, there is still some JavaScript code which remains unmigrated.
This allows for type unsafe code to be written, potentially resulting in
unintended behavior.

Let's migrate repo-sorter.js to TypeScript code to facilitate future
changes to the code.

* [reposense#1936] Migrate safari_date.js to typescript (reposense#2053)

Currently, there is still some JavaScript code which remains unmigrated.
This allows for type unsafe code to be written, potentially resulting in
unintended behavior.

Let's migrate safari_date.js to TypeScript code to facilitate future
changes to the code.

* Remove frontend JS lint (reposense#2063)

Currently, frontend linter is failing due to lint scripts 
checking javascript files, the last of which has been 
removed in PR reposense#2053.

Lets update the lint command to exclude javascript 
files front the check.

* use full and partial credit color

* [reposense#1929] Add dynamic positioning support for tooltips (reposense#2056)

Currently, most tooltips are shown above buttons and text. 
When these tooltips appear at the top of the viewport, 
part of the tooltips will not be rendered.

Let's implement changes such that these tooltips appear below the
text or button, when appearing at the top of the viewport.

* Add test cases for annotated author overriding last author's credit

* revert merge from master

* revert merge from master 58b7002

* [reposense#1928] Fix tooltip zIndex such that it doesn't occlude next file title (reposense#2057)

Currently, if one hovers over a tooltip of the pinned title of
a file whose content is scrolled almost completely, such that 
the title of the next file is just below the pinned title, the 
tooltip is not displayed appropriately, as the title of the next 
file obstructs it.

Let's fix this issue.

* [reposense#1726] Update GitHub-specific references in codebase and docs (reposense#2050)

There are still leftover references specific to GitHub on parts of 
the codebase and docs that have been generalized to accept 
other remote git hosts. 

Let's update these GitHub references to use more general language.

* Trigger workflow

* Revert "Merge branch 'master' into 944-analyze-authorship"

This reverts commit 950c912, reversing
changes made to 4bd05a7.

* fix frontend test failing

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: jq1836 <[email protected]>
Co-authored-by: Chan Jun Da <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pratham Jain <[email protected]>
…eposense#2072)

* [reposense#2027] Fix date range bug (reposense#2034)

Currently, users are unable to select a zoom range that includes 
the until date.

This results in misleading data being presented to users.

* [reposense#2039] Update cypress minimum requirement to 12.15.0 (reposense#2041)

Chrome bug is causing cypress to fail to open a browser on Github 
Actions, causing frontend tests and CI to fail. Upgrading cypress 
to greater than 12.15.0 will fix this issue.

Let's upgrade cypress to fix the failing CI.

* [reposense#1936] Migrate c-segment.vue to typescript (reposense#2035)

Currently, there is still some JavaScript code which remains 
unmigrated. This allows for type unsafe code to be written, 
potentially resulting in unintended behavior.

Let's migrate the rest of the JavaScript code to TypeScript 
code to facilitate future changes to the code.

* [reposense#1936] Migrate load-font-awesome-icons.js to typescript (reposense#2040)

Currently, there is still some JavaScript code which remains 
unmigrated. This allows for type unsafe code to be written, 
potentially resulting in unintended behavior.

Let's migrate the rest of the JavaScript code to TypeScript 
code to facilitate future changes to the code.

* [reposense#2045] Fix cypress zoom feature test (reposense#2047)

Currently, Cypress zoom feature tests are failing due to a recent change
in behavior caused by a bug fix. With the tests failing, we are unable
to detect any future regressions.

Let's update the Cypress tests to test for the new intended behavior.

* [reposense#1936] Migrate random-color-gen.js to typescript (reposense#2043)

Currently, there is still some JavaScript code which remains unmigrated.
This allows for type unsafe code to be written, potentially resulting in
unintended behavior.

Let's migrate random-color-generator.js JavaScript code to TypeScript
code to facilitate future changes to the code.

* [reposense#1936] Migrate c-segment-collection.vue to typescript (reposense#2036)

Currently, there is still some JavaScript code which remains unmigrated.
This allows for type unsafe code to be written, potentially resulting in
unintended behavior.

Let's migrate the rest of the JavaScript code to TypeScript code to
facilitate future changes to the code.

* [reposense#1936] Migrate c-resizer.vue to typescript (reposense#2038)

Currently, there is still some JavaScript code which remains unmigrated.
This allows for type unsafe code to be written, potentially resulting in
unintended behavior.

Let's migrate the rest of the JavaScript code to TypeScript code to
facilitate future changes to the code.

* Bump zod from 3.20.6 to 3.22.3 in /frontend (reposense#2048)

Bumps [zod](https://github.com/colinhacks/zod) from 3.20.6 to 3.22.3.
- [Release notes](https://github.com/colinhacks/zod/releases)
- [Changelog](https://github.com/colinhacks/zod/blob/master/CHANGELOG.md)
- [Commits](colinhacks/zod@v3.20.6...v3.22.3)

---
updated-dependencies:
- dependency-name: zod
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @cypress/request and cypress in /frontend/cypress (reposense#2042)

Bumps [@cypress/request](https://github.com/cypress-io/request) to 3.0.1 and updates ancestor dependency [cypress](https://github.com/cypress-io/cypress). These dependencies need to be updated together.


Updates `@cypress/request` from 2.88.12 to 3.0.1
- [Release notes](https://github.com/cypress-io/request/releases)
- [Changelog](https://github.com/cypress-io/request/blob/master/CHANGELOG.md)
- [Commits](cypress-io/request@v2.88.12...v3.0.1)

Updates `cypress` from 12.17.4 to 13.3.0
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/CHANGELOG.md)
- [Commits](cypress-io/cypress@v12.17.4...v13.3.0)

---
updated-dependencies:
- dependency-name: "@cypress/request"
  dependency-type: indirect
- dependency-name: cypress
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [reposense#1936] Migrate c-ramp.vue to typescript (reposense#2037)

Currently, there is still some JavaScript code which remains unmigrated.
This allows for type unsafe code to be written, potentially resulting in
unintended behavior.

Let's migrate the rest of the JavaScript code to TypeScript code to
facilitate future changes to the code.

* Give partial credit if annotated author is not the same as the blame
author

* [reposense#2054] Fix zoom view bug (reposense#2055)

Currently, when granularity is set to day or week, clicking on a ramp
will open up a zoom view where commit messages are not being displayed
and sorting by insertions does not result in any sorting. 

Let's fix the unintended behaviour of the zoom view.

* [reposense#1936] Migrate repo-sorter.js to typescript (reposense#2052)

Currently, there is still some JavaScript code which remains unmigrated.
This allows for type unsafe code to be written, potentially resulting in
unintended behavior.

Let's migrate repo-sorter.js to TypeScript code to facilitate future
changes to the code.

* [reposense#1936] Migrate safari_date.js to typescript (reposense#2053)

Currently, there is still some JavaScript code which remains unmigrated.
This allows for type unsafe code to be written, potentially resulting in
unintended behavior.

Let's migrate safari_date.js to TypeScript code to facilitate future
changes to the code.

* Remove frontend JS lint (reposense#2063)

Currently, frontend linter is failing due to lint scripts 
checking javascript files, the last of which has been 
removed in PR reposense#2053.

Lets update the lint command to exclude javascript 
files front the check.

* use full and partial credit color

* [reposense#1929] Add dynamic positioning support for tooltips (reposense#2056)

Currently, most tooltips are shown above buttons and text. 
When these tooltips appear at the top of the viewport, 
part of the tooltips will not be rendered.

Let's implement changes such that these tooltips appear below the
text or button, when appearing at the top of the viewport.

* Add test cases for annotated author overriding last author's credit

* revert merge from master

* revert merge from master 58b7002

* [reposense#1928] Fix tooltip zIndex such that it doesn't occlude next file title (reposense#2057)

Currently, if one hovers over a tooltip of the pinned title of
a file whose content is scrolled almost completely, such that 
the title of the next file is just below the pinned title, the 
tooltip is not displayed appropriately, as the title of the next 
file obstructs it.

Let's fix this issue.

* [reposense#1726] Update GitHub-specific references in codebase and docs (reposense#2050)

There are still leftover references specific to GitHub on parts of 
the codebase and docs that have been generalized to accept 
other remote git hosts. 

Let's update these GitHub references to use more general language.

* Trigger workflow

* Revert "Merge branch 'master' into 944-analyze-authorship"

This reverts commit 950c912, reversing
changes made to 4bd05a7.

* fix frontend test failing

* switch to originality score and threshold

* update originality threshold

* revert frontend code changes

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: jq1836 <[email protected]>
Co-authored-by: Chan Jun Da <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pratham Jain <[email protected]>
…erged (reposense#2089)

Currently, when viewing individual contributions, full and partial
credit are differentiated with dark and light green colors. However,
this distinction is not applied when the group is merged, potentially
causing confusion for users.

Let's introduce a clear differentiation between full and partial credit
when viewing a merged group.
The existing setup employs a static originality threshold of 0.51.
However, this threshold is tailored for codes, such as Java or Markdown,
and might not be suitable for other programming languages. Additionally,
it doesn't offer flexibility for users who may want a stricter threshold
but are willing to endure longer processing times, or those who prefer a
more lenient threshold but prioritize faster analysis speeds.

Let's enable users to input their preferred originality threshold.
Currently, the authorship credit analysis process exceeds an hour in
duration, which is significantly longer than the mere 5 minutes required
when the feature is deactivated.

Let's speed up the performance by implementing a caching mechanism and
refining the dynamic programming algorithm utilized for computing the
Levenshtein distance.
Currently the branch is ready but out of sync with the master branch,
which had some major revamp in both the frontend and backend.

Let's merge the master branch into this branch to keep it up to date.
@SkyBlaise99 SkyBlaise99 closed this Mar 7, 2024
Copy link
Contributor

github-actions bot commented Mar 7, 2024

The following links are for previewing this pull request:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve code authorship attribution
1 participant