Repository navigation
Solaris: extract prtpicl, prtconf USB, svcs, and plimit/pbind parsers - #3498
Conversation
Extract remaining Solaris-specific command parsers into testable static methods, continuing the coverage work from #3497. Extractions: - SolarisSensors: parseCpuTemperature, parseFanSpeeds, parseVoltage (prtpicl -v -c temperature-sensor/fan/voltage-sensor) - SolarisUsbDevice: parsePrtconf (prtconf -pv USB device tree) - SolarisOperatingSystem: parseSvcs (svcs -p service enumeration) - SolarisOSProcess: parseOpenFileLimit (plimit), parsePbindOutput (pbind -q), parsePsrinfo (psrinfo processor enumeration)
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (13)
📝 WalkthroughWalkthroughSolaris hardware, process, USB, and service collectors now separate native command execution from output parsing. New JUnit tests cover normal, empty, malformed, and alternate Solaris command-output formats. ChangesSolaris parser extraction
Estimated code review effort: 3 (Moderate) | ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 #3498 +/- ##
============================================
+ Coverage 76.00% 76.20% +0.20%
Complexity 76 76
============================================
Files 591 591
Lines 21676 21679 +3
Branches 3612 3611 -1
============================================
+ Hits 16474 16521 +47
+ Misses 3247 3207 -40
+ Partials 1955 1951 -4
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:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java (1)
61-74: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove stale comment and simplify array conversion.
The comment
// Return max found tempappears to be accidentally copied fromparseCpuTemperature. Additionally, the manual list population and array conversion can be simplified by leveraging Java 8 streams.♻️ Proposed refactor
static int[] parseFanSpeeds(List<String> prtpicl) { - List<Integer> speedList = new ArrayList<>(); - // Return max found temp - for (String line : prtpicl) { - if (line.trim().startsWith("Speed:")) { - speedList.add(ParseUtil.parseLastInt(line, 0)); - } - } - int[] fans = new int[speedList.size()]; - for (int i = 0; i < speedList.size(); i++) { - fans[i] = speedList.get(i); - } - return fans; + return prtpicl.stream() + .filter(line -> line.trim().startsWith("Speed:")) + .mapToInt(line -> ParseUtil.parseLastInt(line, 0)) + .toArray(); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java` around lines 61 - 74, In parseFanSpeeds, remove the stale “max found temp” comment and replace the manual speedList-to-array loop with a Java 8 stream-based conversion, preserving the existing parsed fan speed order and returned int[] behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java`:
- Around line 61-74: In parseFanSpeeds, remove the stale “max found temp”
comment and replace the manual speedList-to-array loop with a Java 8
stream-based conversion, preserving the existing parsed fan speed order and
returned int[] behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 3693b02e-9a06-4568-b9c2-997328827cdc
📒 Files selected for processing (8)
oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDevice.javaoshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOSProcess.javaoshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystem.javaoshi-common/src/test/java/oshi/hardware/common/platform/unix/solaris/SolarisSensorsTest.javaoshi-common/src/test/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDeviceTest.javaoshi-common/src/test/java/oshi/software/common/os/unix/solaris/SolarisOSProcessTest.javaoshi-common/src/test/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystemTest.java
📜 Review details
⏰ Context from checks skipped due to timeout. (13)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
- GitHub Check: Test JDK 26, macos-latest
- GitHub Check: Test JDK 21, windows-latest
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
- GitHub Check: Test JDK 26, windows-latest
- GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.
Applied to files:
oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDevice.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.javaoshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystem.javaoshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOSProcess.java
📚 Learning: 2026-07-06T19:25:59.225Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3432
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:26-56
Timestamp: 2026-07-06T19:25:59.225Z
Learning: In this repo’s SLF4J 1.x-compatible logging code, do not flag cases where a logger call uses SLF4J 1.6+ implicit-cause handling—e.g., `log.error("...{}", value, t)` (or similar with a single `{}` placeholder) where `t` is passed as the final/trailing argument. SLF4J will attach `t` as the log event’s cause with the full stack trace; this is equivalent to SLF4J 2.x’s fluent `atLevel(...).setCause(t).log(...)` and is intentionally used to preserve SLF4J 1.x runtime compatibility.
Applied to files:
oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDevice.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.javaoshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystem.javaoshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOSProcess.java
🔇 Additional comments (8)
oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java (1)
23-48: LGTM!Also applies to: 78-96
oshi-common/src/test/java/oshi/hardware/common/platform/unix/solaris/SolarisSensorsTest.java (1)
18-69: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDevice.java (1)
40-55: LGTM!oshi-common/src/test/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDeviceTest.java (1)
22-80: LGTM!oshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOSProcess.java (1)
95-111: LGTM!Also applies to: 128-145, 230-244
oshi-common/src/test/java/oshi/software/common/os/unix/solaris/SolarisOSProcessTest.java (1)
18-80: LGTM!oshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystem.java (1)
145-168: LGTM!oshi-common/src/test/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystemTest.java (1)
23-78: LGTM!
Summary
Test plan
./mvnw clean install— 1197 tests, 0 failures)@EnabledOnOsgating on parse tests — they run on every platformSummary by CodeRabbit
svcsoutput and legacy service mappings.