RepoSense icon indicating copy to clipboard operation
RepoSense copied to clipboard

One team showing 0 files changes

Open damithc opened this issue 1 year ago • 2 comments

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

damithc avatar Nov 13 '24 16:11 damithc

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.

gok99 avatar Nov 13 '24 19:11 gok99

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

damithc avatar Nov 14 '24 02:11 damithc