SONARJAVA-6947 Share an interface between checks that require caching - #6118
Conversation
5dddaaf to
427db09
Compare
7788bcd to
dd669e5
Compare
dd669e5 to
421546a
Compare
421546a to
224b48b
Compare
56f466d to
df445d2
Compare
df445d2 to
9c0b7d1
Compare
There was a problem hiding this comment.
When I've created this ticket I've had in mind that this unification should be applied to all the rules that use caching. Currently we already have 5 existing rules which use caching in our main branch. Correct approach would be:
- implement PR based on our main branch where we introduce this mechanism and apply to existing rules
- rebase epic-SNARJAVA-6237 to master after we merge the first PR and create PR to implement this mechanism for these Gatherer checks.
If we would plan to merge epic branch to master soon then we could implement this unification for all rules here. But I'm not sure about the timeline of this merge, as we have several follow-ups to be fixed. Also the approach with 2 different PRs looks more accurate.
The PR implementation itself looks good, only a little comment below.
|
|
||
| private static List<String> deserializePackages(String content) { | ||
| return List.copyOf(deserializeStrings(requiredArray(parseDocument(content, CACHE_FORMAT_VERSION), PACKAGES))); | ||
| private static String toContent(byte[] data) { |
There was a problem hiding this comment.
We use this method only with parseDocument(toContent(data), CACHE_FORMAT_VERSION) expression. Let's get rid of it and extract parseDocument(...) to the private method instead.
Code Review ✅ Approved 11 closed / 11 findingsRefactoring to share a caching interface between checks that require per-file data caching. Introduces ✅ 11 closed✅ Quality: JsonCacheFormat javadoc promises IAE but throws other types
✅ Quality: "Cache problems are never fatal" is false for read I/O errors
✅ Quality: writeToCache's catch covers serialize(), mislabelling its failures
✅ Quality: Stray '≥' character in projectToNames javadoc @return
✅ Quality: Fallback javadoc says "same class" but suppression is file-wide
...and 6 more closed from earlier reviews Review coverageFunctional validation No results OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|
d2e59ff
into
epic-SONARJAVA-6237



Summary by Gitar
FileCachingCheckmixin interface for JSON-based per-file data cachingComponentScanPackageGatherer, andBeanDefinitionGathererto implementFileCachingCheckThis will update automatically on new commits.