Feature dtcenter/METplus-Internal#68 SonarQube Blockers - #3440
Open
JohnHalleyGotway wants to merge 26 commits into
Open
Feature dtcenter/METplus-Internal#68 SonarQube Blockers#3440JohnHalleyGotway wants to merge 26 commits into
JohnHalleyGotway wants to merge 26 commits into
Conversation
…Array to be nothrow move constructible for SonarQube.
…tructible for SonarQube.
…8_sonarqube_blockers
…8_sonarqube_blockers
…d handle empty regex strings.
…out to the GitHub action artifact.
…on output and flagging the GOTO statements they contain based on the cpp:S999 rule.
…e the load on the dtc-sca server.
…orn blocker issue.
…_array.h, including a 'Reliability' one.
…gine.h/.cc, including a 'Reliability' one.
…n point2grid.cc.
…8_sonarqube_blockers
…ngs.sh script based on PR feedback from SonarCloud.
JohnHalleyGotway
marked this pull request as ready for review
September 11, 2026 19:09
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary of Changes
Works through SonarQube static-analysis findings for MET (dtcenter/METplus-Internal#68), prioritizing Blocker/Critical severity and genuine correctness ("Reliability") issues over pure style.
Bug fixes found along the way
Several findings turned out to be pointing at real bugs, not just style:
ThreshArray::check_bins()— a variable-shadowing bug left the function returning an uninitialized stack value instead of the computed bin index, causinggrid_statto crash with a contingency-table range-check error. Fixed alongside a relatedcheck_prefix_suffix()bug that calledregcomp()with an empty pattern (silently tolerated on Linux, rejected on macOS).CRC_Array<T>::sum()(backsIntArray/BoolArray) — the identical shadowing pattern, causingsum()to read an uninitializedcountand return garbage for the empty-array case.MM_Engine(mode_time_domain) — a manually-managedint*member (comp_to_eq) could be read before being sized to match what was actually written into it. Converted toIntArray(RAII), removing the rawnew/deletebookkeeping.point2grid.cc(regrid_nc_variable()) — a debug log message could report the wrong source data offset, since it reused a loop variable (from_index) holding the last checked index rather than the contributing one.track_info.cc(TrackInfo::add()) — added an explicit bounds check on an array write; the invariant already held in practice, but wasn't provable across a private-method call boundary.Move-semantics modernization
Gave several hand-rolled container classes (
ConcatString,StringArray,NumArray,IntArray,TimeArray,ThreshArray,CRC_Array<T>,Shp_Array<T>,NCRR_Array<T>,SingleThresh,VxPairDataPoint) propernoexceptmove constructors/assignment operators, or reimplemented them onstd::vector— resolving a large class of "moving an object is not noexcept" findings.Style / best-practice cleanup
Addressed a long tail of findings: excessive nesting, variable shadowing, redundant multi-variable declarations,
0/NULLvs.nullptr,protectedvs.privatedata members,operator==converted to a hidden friend, rawnew/deletereplaced with RAII containers, and similar.Excluded generated code from analysis
Bison-generated parser files (
config.tab.cc,color_parser_yacc.cc,enum_parser.cc) containgoto-based state machines intrinsic to bison's own parser skeleton — not something a grammar file can avoid. Addedsonar.exclusionsfor these rather than chasing an unfixable finding.CI / developer tooling
report-task.txtnow included in the workflow's log artifact.internal/scripts/sonarqube/fetch_sonarqube_findings.sh, a local developer tool that pulls findings from the SonarQube Web API (working around its 10,000-result pagination cap by splitting queries by severity/type) and rate-limits requests to avoid overloading the shared server. Deliberately not wired into CI — findings shouldn't land in a public repo's workflow artifacts.Testing
make test) passes.mode_time_domainandpoint2gridaren't covered by that suite; both were additionally verified with direct end-to-end runs against real sample data.Expected Differences
Do these changes introduce new tools, command line arguments, or configuration file options? [No]
If yes, please describe:
Do these changes modify the structure of existing or add new output data types (e.g. statistic line types or NetCDF variables)? [No]
If yes, please describe:
Pull Request Testing
Describe testing already performed for these changes:
Ran the SonarQube scan several times to confirm that all blockers in MET have been addressed.
Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:
Ensure that testing workflow flags no differences in the output.
Check the SonarQube scan results to confirm that the
Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [Yes]
None needed
Do these changes include sufficient testing updates? [Yes]
No new tests needed. Use existing.
Will this PR result in changes to the MET test suite? [No]
If yes, describe the new output and/or changes to the existing output:
Will this PR result in changes to existing METplus Use Cases? [No]
If yes, create a new Update Truth METplus issue to describe them.
Do these changes introduce new SonarQube findings? [No]
If yes, please describe:
As of this pull request, 14,082 SonarQube issues are flagged in the
developbranch. These include 1 "Reliability" issue and 20 "Blockers".This pull request reduces that by 401 to 13,681 issues with 0 reliability issues and 0 blockers.
Warning
6 of 20 "Blocker" issues are now just ignored. This PR modifies
sonar-project.propertiesto NOT SCAN code that is automatically generated by bison. The resultinggotostatements still exist in the output and cannot be removed. Recommend that the USAF use a similar setting to avoid scanning code generated by bison.Pull Request Checklist
See the METplus Workflow for details.
Select: Reviewer(s) and Development issue
Select: Milestone as the version that will include these changes
Select: METplus-X.Y Support project for bugfix releases or MET-X.Y Development project for the next coordinated release