-
-
Notifications
You must be signed in to change notification settings - Fork 771
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
Always update the baseline if it exists #4445
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4445 +/- ##
=========================================
Coverage 84.34% 84.34%
- Complexity 3299 3300 +1
=========================================
Files 473 473
Lines 10532 10534 +2
Branches 1885 1885
=========================================
+ Hits 8883 8885 +2
Misses 671 671
Partials 978 978
Continue to review full report at Codecov.
|
@BraisGabin shall we also explain the new behavior in the FAQ section on the homepage? |
I don't think so. There wasn't any explanation about when the baseline was created or not. And what this PR does have more sense than the previous behavior. |
if (baseline.isNotEmpty() || exists) { | ||
baselineFile.parent?.let { Files.createDirectories(it) } | ||
BaselineFormat().write(baseline, baselineFile) | ||
} |
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.
If the content stays the same, always writing to the file will cause the Detekt Gradle task to always not up-to-date.
Do you think it's worth it to not update the file when the content does not change?
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.
The content is always the same so it doesn't affect gradle and the up-to-date
. But I'm going to do the check so we avoid an unnecessary write to disk.
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.
Done, I think that the code now is even better.
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.
Ah nice. I had thought the file last access timestamp is considered in the input cache key calculation.
Is this a notable change? I feel it as a bug-fix. |
I think it is - There could be additional tooling that reads those baseline.xml and generates a customized report (My previous team does that) |
If you have a module with some issues in the baseline and you fix all of them, when you update the baseline detekt does nothing. This PR fixes that. If there is a baseline file, we always update it.
This PR also fixes a really annoying flaky test related with baseline.
Fix #3736