reposense / RepoSense

Contribution analysis tool for Git repositories
https://reposense.org
MIT License
249 stars 155 forks source link

One team showing 0 files changes #2254

Open damithc opened 2 days ago

damithc commented 2 days ago

Happening in this dashboard

image

One team is showing '0 files changed' for all team members. All other teams are fine.

Any idea about the case?

Repo https://github.com/nus-cs2113-AY2425S1/tp-dashboard

gok99 commented 2 days ago

Diagnosis

This seems to be caused by a line ending issue in this file which used CRLF line endings. When we read the file with BufferedReader::readLine, lines are split by LF or CRLF until EOF. However, git blame (and the GitHub file viewer) sees this as a single line file and only produces authorship for the first line. The produced authorship.json line info for this file then has missing fields for subsequent lines, which fails frontend schema validation, causing it to erroneously display "0 files changed".

Potential Fix

In reading non-binary files, we should probably split lines by only \n, perhaps using Scanner and Scanner::useDelimiter to match git output. We should also add tests for files with CRLF line endings, and have a check during report generation to ensure that the final authorship (and other) configs contain all required fields.

In the meantime, having the team standardize their line endings to LF (and their git autocrlf settings) is a quick temporary fix.

damithc commented 1 day ago

@gok99 Thanks for the quick investigation. I'll inform the team.