Repository navigation
Clear the Sonar findings from the 7.8.0 work - #3901
Conversation
- S8786: possessive quantifiers in the BSD pkg_info, Solaris FMRI and NetBSD dmesg patterns; a device name that must end in a unit number is matched as \w++(?<=\d) rather than by backtracking \w+\d+. The OpenBSD name/version split follows packages-specs(7) without a lazy quantifier. - S135: the Solaris smbios and NetBSD dmesg loops are if/else chains; the smbios key=value parsing moved into the record class. - S3252: AF_* constants statically imported from JNA's IPHlpAPI. - S1192: SUPER_IO and a DEVICE constant replace repeated literals. - S5411, S9435, S3358, S4276, S6213, S1128, S1075, S125 (a comment that read as code), and S116 for the tb_last fields of the AIX CPU POJOs (tbLast).
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3901 +/- ##
============================================
- Coverage 81.64% 81.57% -0.07%
- Complexity 1288 1314 +26
============================================
Files 735 735
Lines 27695 27695
Branches 4798 4799 +1
============================================
- Hits 22611 22593 -18
- Misses 2780 2804 +24
+ Partials 2304 2298 -6
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:
|
config/sonar-project.properties was read by properties-maven-plugin, but the plugin was only declared in pluginManagement and never bound, so none of its ignore rules reached the analysis and the JNA naming findings were accepted by hand. Bind it, and cover the remaining binding conventions: S101, S116 and S117 under jna, and S100 under ffm/platform.
CodeQL flagged the env loop because its condition tested addr, which never changed. addr is the table's base, read once (pr_envp points to the pointer table, as pr_argv does), not an entry to re-read: entries were read at offset, and the null entry ended the loop through break. Name it envTable, test it once, and walk its entries by index, in both the JNA and FFM readers. The cap is 500 entries, where --limit stopped at 499.
#3902) * Annotate IOKitProvider registry getters @nullable The RegistryEntry getters document returning null when a property or name is absent, and the JNA and FFM entries delegate to IOKit calls that do, but none carried @nullable, so NullAway could not check their callers. Every existing caller already handles null; the build is unchanged. * Report ARM64 Windows processor stepping and ID from MIDR_EL1 On ARM64 the registry Identifier reads "ARMv8 (64-bit) Family 8 Model D49 Revision 0": no Stepping, so stepping was empty, and Win32_Processor's ProcessorId is all zeros (GitHub windows-11-arm runner, Azure Cobalt 100). Each processor's registry key carries MIDR_EL1 as CP 4000 (0x410fd490 there). Stepping is now Linux's r<variant>p<revision> from it, and the processor ID the MIDR in hex followed by eight zeros, as Linux reports on ARM. Both twins read the QWORD; the choice lives in WindowsCentralProcessor. * Use the SUPER_IO constant for the LHM voltage sensors The last Sonar S1192 finding on master, next to the fan read fixed in #3901. * Stop recommending the jLibreHardwareMonitor dependency Its static PowerShell session is never closed and holds two non-daemon threads, so a JVM with the jar on the class path does not exit after main returns. It bundles LibreHardwareMonitorLib 0.9.4, whose WinRing0 driver Microsoft Defender flags as a hacking tool. It also returns nothing on some hosts (#3707). The maintainer has not answered any report (filed as pandalxb/jLibreHardwareMonitor#2), so the README, the FAQ and the Sensors javadoc now point to the LibreHardwareMonitor application instead. The FAQ lists the problems and says support may be removed in a future release. OSHI still reads the jar when it is present. The Sensors interface javadoc also listed the sources in the wrong order. Fixed that here. Also adds the CHANGELOG entry for the ARM64 Windows stepping change. * State which LibreHardwareMonitor versions publish to WMI LibreHardwareMonitor 0.9.5 removed its WMI provider (upstream aaf65f5, "no longer working with .NET 10"), and later releases do not restore it. OSHI's ROOT\LibreHardwareMonitor queries therefore find nothing with a current release. The README, FAQ, CHANGELOG and Sensors javadoc now say that only OpenHardwareMonitor and LibreHardwareMonitor 0.9.4 and earlier publish to WMI, and that both load the WinRing0 driver Defender flags.
Release prep. No user-visible change, so no CHANGELOG entry.
SonarCloud had 81 open issues on master, all from this cycle's PRs. CodeQL code scanning has no open alerts; CodeQL Code Quality had two findings, below.
Fixed here (27):
PkgInfoInstalledApps,SolarisInstalledAppsandNetBsdGraphicsCard, made possessive where that leaves the match unchanged. A unit-numbered device name becomes\\w++(?<=\\d)instead of the backtracking\\w+\\d+, and the OpenBSD name/version split is written without a lazy quantifier.smbiosand NetBSDdmesgloops are restructured as if/else chains.tb_lastfields of the AIX CPU POJOs (nowtbLast; the JNA struct field keeps its C name).Accepted in SonarCloud, with a reason comment on each (54):
IPHlpAPI,Kernel32FFMandIPHlpAPIFFM: S100, S101, S116, S117, S2160.MacSystemFunctions.FreeBsdSoundCard.Sonar config now loaded:
config/sonar-project.propertiesholds issue-ignore rules for the JNA naming conventions.properties-maven-pluginwas only declared inpluginManagementand never bound, so the file was never read, which is why those findings were accepted one by one. The plugin is now bound in the root build, and the rules also cover S101, S116 and S117 underjna, and S100 underffm/platform. Confirmed with./mvnw initialize help:evaluate -Dexpression=sonar.issue.ignore.multicriteriain the root and a module.CodeQL Code Quality findings (2):
addr: a false positive, but the code was misleading.addris the env table's base, read once (pr_envppoints to the pointer table, aspr_argvdoes), not an entry to re-read. Entries were read atoffset, and the null entry ended the loop throughbreak. Both AIX readers (JNA and FFM) now name itenvTable, test it once and walk the entries by index. The cap is now exactly 500 entries;--limitstopped at 499.useLegacySystemCounters()test intent not at class level: to be dismissed. The method javadoc already says it is overridable for tests, and both Windows twins say they are notfinalfor that reason.Verification: full gate with
-Paggregate-coverage -Perror-proneand tests; existing fixture tests cover every changed regex and loop.Summary by CodeRabbit
Bug Fixes
Refactor