Skip to content

Commit

Permalink
Revert "Replace magic number with BLAME_LINE_LENGTH"
Browse files Browse the repository at this point in the history
This reverts commit 23407c0.
  • Loading branch information
logical-1985516 committed Jul 3, 2024
1 parent 23407c0 commit de96899
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/reposense/authorship/FileInfoAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class FileInfoAnalyzer {
private static final int AUTHOR_EMAIL_OFFSET = "author-mail ".length();
private static final int AUTHOR_TIME_OFFSET = "author-time ".length();
private static final int AUTHOR_TIMEZONE_OFFSET = "author-tz ".length();
private static final int BLAME_LINE_LENGTH = 5;
private static final int FULL_COMMIT_HASH_LENGTH = 40;

private static final String MESSAGE_FILE_MISSING = "Unable to analyze the file located at \"%s\" "
Expand Down Expand Up @@ -162,7 +161,7 @@ private void aggregateBlameAuthorModifiedAndDateInfo(RepoConfiguration config, F
LocalDateTime sinceDate = config.getSinceDate();
LocalDateTime untilDate = config.getUntilDate();

for (int lineCount = 0; lineCount < blameResultLines.length; lineCount += BLAME_LINE_LENGTH) {
for (int lineCount = 0; lineCount < blameResultLines.length; lineCount += 5) {
String commitHash = blameResultLines[lineCount].substring(0, FULL_COMMIT_HASH_LENGTH);
String authorName = blameResultLines[lineCount + 1].substring(AUTHOR_NAME_OFFSET);
String authorEmail = blameResultLines[lineCount + 2]
Expand All @@ -172,7 +171,7 @@ private void aggregateBlameAuthorModifiedAndDateInfo(RepoConfiguration config, F
config.getZoneId());
Author author = config.getAuthor(authorName, authorEmail);

int lineNumber = lineCount / BLAME_LINE_LENGTH;
int lineNumber = lineCount / 5;
if (!fileInfo.isFileLineTracked(lineNumber) || author.isIgnoringFile(filePath)
|| CommitHash.isInsideCommitList(commitHash, config.getIgnoreCommitList())
|| commitDate.isBefore(sinceDate) || commitDate.isAfter(untilDate)) {
Expand Down

0 comments on commit de96899

Please sign in to comment.