-
Notifications
You must be signed in to change notification settings - Fork 52
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
SLCORE-1142 Improve Git blaming for the analysis #1247
base: master
Are you sure you want to change the base?
Conversation
bd862b3
to
c0d21fe
Compare
94fe8c7
to
9ea9367
Compare
9ea9367
to
625d54b
Compare
1b25257
to
5c8cf22
Compare
5c8cf22
to
f97e0ce
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments, overall LGTM.
Maybe it would deserve some medium tests to make sure everything is plugged together
@@ -62,6 +62,8 @@ static NewCodeDefinition withNumberOfDaysWithDate(int days, long thresholdDate) | |||
return new NewCodeNumberOfDaysWithDate(days, thresholdDate); | |||
} | |||
|
|||
long getThresholdDate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not returning an Instant from here? You can make the conversion later when you use it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think threshold date is maybe not precise enough. I am bad at naming, but what about something like "period start date"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I would move the method somewhere else, to not be in the middle of with*
methods.
@@ -116,6 +118,11 @@ public boolean isSupported() { | |||
return true; | |||
} | |||
|
|||
@Override | |||
public long getThresholdDate() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this method also be implemented in NewCodeDefinitionWithDate
? Maybe it's the case.
EDIT: I see this abstract class is not used at all, maybe we could remove it?
@@ -189,6 +192,11 @@ public static SonarLintBlameResult blameFromNativeCommand(Path projectBaseDir, S | |||
throw new IllegalStateException("There is no native Git available"); | |||
} | |||
|
|||
private static String getBlameHistoryWindow(long thresholdDate) { | |||
var blameLimit = Instant.ofEpochMilli(thresholdDate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to what I said earlier, we create Instants that we convert to a timestamp, then back to an Instant
SLCORE-1142