Repository navigation
Sonar mechanical sweep: idioms, functional interfaces, merge-if, logging (11 rules) - #3397
Conversation
…26, S1153)
- S7158: replace length()==0 / length()>0 with isEmpty().
- S4201: drop the redundant null check before instanceof.
- S6353/S6326: concise regex classes (\d, \D) and the {2} space quantifier.
- S1153: drop redundant String.valueOf() in string concatenation.
No behavior change.
Combine each outer if whose sole body is an inner if into a single condition (parenthesizing where an || is involved). No behavior change.
Replace generic Function/BiFunction params with the specialized interface that fits the usage: BiPredicate (WindowsSensors, also fixing S5411 boxed-Boolean unboxing), Predicate (IOKitProvider + JNA/FFM impls, removing the now-needless Boolean.TRUE.equals null guard since visitors return primitive boolean), BinaryOperator (FreeBsd/OpenBsd sysctl accessor), ToLongFunction (LinuxGraphicsCard vram lookup), UnaryOperator (CupsPrinter driver lookup). No behavior change.
… S3038) - S1170: instance final-constant fields -> static final (Linux IP-stats fields renamed to UPPER_CASE to keep them naming-convention compliant). - S3038: remove LinuxHardwareAbstractionLayer's bare redundant abstract getGraphicsCards() re-declaration (still declared on the interface).
- S1301: convert the demo's single-case platform switch to an if/else. The three PrivilegedUtil switches are intentionally kept (extensibility for future OSes) with an explanatory comment. - S2629: convert RegistryUtil's string-concat log to parameterized form, and guard the two sysctl WARN logs with isWarnEnabled() so the native getErrno() read is skipped when WARN is disabled.
Per project convention, import Supplier rather than fully-qualifying it inline
(WmiQueryHandlerFFM) or in javadoc {@link} (Memoizer).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (35)
💤 Files with no reviewable changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
🧰 Additional context used🧠 Learnings (3)📚 Learning: 2026-04-06T04:45:47.644ZApplied to files:
📚 Learning: 2026-04-12T19:22:09.716ZApplied to files:
📚 Learning: 2026-04-12T19:34:56.879ZApplied to files:
🔇 Additional comments (34)
📝 WalkthroughWalkthroughA broad code-quality sweep across ChangesCode Quality Sweep
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3397 +/- ##
============================================
- Coverage 75.07% 75.04% -0.03%
Complexity 76 76
============================================
Files 579 579
Lines 21356 21351 -5
Branches 3557 3555 -2
============================================
- Hits 16032 16022 -10
- Misses 3299 3301 +2
- Partials 2025 2028 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A batch of mechanical Sonar fixes, grouped into 6 thematic commits. Each finding was validated as real before fixing. No behavior change to query results; verified with a clean
install -P aggregate-coverage,native-comparison(full unit suite + NativeComparisonTest green) plus checkstyle/forbiddenapis/javadoc.Fixed (~40 findings)
length()==0/>0→isEmpty()instanceof\d,\D,{2})String.valueOf()in concatenationifs (parenthesized where an||is involved)BiPredicate/Predicate/BinaryOperator/ToLongFunction/UnaryOperator(incl. removing the now-needlessBoolean.TRUE.equalsguard in IOKit)static final(Linux fields renamed UPPER_CASE to stay convention-compliant)LinuxHAL's bare redundant abstract methodifRegistryUtilconcat-log → parameterized; the two sysctl WARN logs guarded withisWarnEnabled()so the nativegetErrno()read is skipped when WARN is offjava.util.function.*inline/javadoc FQNs → importsAccepted as won't-fix (with reasons), not in this diff
Integer.toHexString(int)in rarely-taken failure branches (guarding = boilerplate for negligible gain; the native-call ones above were guarded instead)PrivilegedUtil) — single-case platform switches intentionally kept open for future-OS extensibility (comment added)AixGlobalMemory) — the abstract re-declaration carries class-specific javadoc the interface doesn'tNote on slf4j
The lazy fluent API (
atWarn().addArgument(() -> …)) would have been the elegant fix for thegetErrnologs, but OSHI's OSGiImport-Packagepins slf4j to[1.7,3.0)and uses no 2.0-only API — so anisWarnEnabled()guard is used to stay runtime-compatible with slf4j 1.7.Summary by CodeRabbit
Refactor
Performance
Documentation