-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCodeAnalysisResult.cs
More file actions
21 lines (19 loc) · 870 Bytes
/
CodeAnalysisResult.cs
File metadata and controls
21 lines (19 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
namespace LinesOfCodeCounter;
public record CodeAnalysisResult
{
public int TotalFiles { get; set; }
public long TotalLines { get; set; }
public long TotalCharacters { get; set; }
public float AverageLinesPerFile { get; set; }
public float AverageCharactersPerFile { get; set; }
public float AverageCharactersPerLine { get; set; }
public CodeAnalysisResult(HashSet<CodeFile> codeFiles)
{
TotalFiles = codeFiles.Count;
TotalLines = codeFiles.Sum(x => x.TotalLinesOfCode);
TotalCharacters = codeFiles.Sum(x => x.TotalCharacterCount);
AverageLinesPerFile = TotalFiles > 0 ? TotalLines / (float)TotalFiles : 0;
AverageCharactersPerFile = TotalFiles > 0 ? TotalCharacters / (float)TotalFiles : 0;
AverageCharactersPerLine = TotalLines > 0 ? TotalCharacters / (float)TotalLines : 0;
}
}