Repository navigation
kvs: fix CodeQL MISRA C++:2023 findings - #638
Merged
PandaeDo merged 1 commit intoNov 2, 2026
Merged
Conversation
arkjedrz
requested review from
PandaeDo,
antonkri,
umaucher and
vinodreddy-g
as code owners
November 2, 2026 10:59
arkjedrz
requested a deployment
to
workflow-approval
November 2, 2026 10:59 — with
GitHub Actions
Waiting
arkjedrz
requested a deployment
to
workflow-approval
November 2, 2026 10:59 — with
GitHub Actions
Waiting
Contributor
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
Contributor
|
Documentation preview for this pull request is available at: |
The C++ CodeQL job reports MISRA C++:2023 results for the KVS. Fix the code where a rule points at a real issue, and record a deviation for the rest. Code changes: - Discard unused emplace, insert_or_assign and read results through score::cpp::ignore (Rule 0.1.2). - Add clarifying parentheses and use unsigned masks for the Adler-32 hash bytes (Rules 8.0.1 and 7.0.4). - Replace structured bindings in range-for loops with `.first` and `.second` (Rules 9.3.1, 11.6.1, 5.10.1 and 10.0.1). - Pass HasUniqueKeys and a new IsPrintableAscii predicate to std::all_of instead of lambdas (Rule 8.2.10). - Drop the comma operator from the Adler-32 loop (Rules 8.19.1 and 9.5.1). - Complete if-else chains and the switch in HasUniqueKeys, and hoist JSON ranges into named references (Rules 9.4.1, 9.4.2 and 9.5.2). - Rename snapshots through score::os::Stdio (Rule 30.0.1). - Ref-qualify the assignment operators of Kvs and KvsValue, and split KvsValue::GetValue into const& and && overloads (Rules 15.0.2 and 6.8.4). - Give KvsValue::Type the underlying type std::uint8_t (Rule 10.2.1). - Read character codes and hash bytes through std::char_traits<char>::to_int_type (Rules 7.0.3 and 8.2.5). - Declare namespace-scope constants const instead of constexpr (Rule 4.1.2). CI changes: - Add coding-standards.yaml with the remaining MISRA deviations and their justifications. - Index the deviations into the CodeQL database with the coding-standards scripts at v2.62.0, pinned by sha256. - Disapply the advisory Rule 21.6.1, as the KVS uses std::string, std::map and std::vector by design. This changes the public API. Assigning to an rvalue Kvs or KvsValue no longer compiles. KvsValue::GetValue on a temporary returns a value instead of a reference. The size of KvsValue::Type changes, which affects the ABI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
arkjedrz
force-pushed
the
arkjedrz_codeql-cpp-fixes
branch
from
November 2, 2026 12:49
7261474 to
c7905f2
Compare
karolnowak
approved these changes
Nov 2, 2026
karolnowak
left a comment
Contributor
There was a problem hiding this comment.
Overall, looks good to me - good starting point.
It would be good to have a cmd to check code violations locally.
Contributor
Author
|
Regarding local repro #645 |
PandaeDo
approved these changes
Nov 2, 2026
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.
The C++ CodeQL job reports MISRA C++:2023 results for the KVS. Fix the code where a rule points at a real issue, and record a deviation for the rest.
Code changes:
.firstand.second(Rules 9.3.1, 11.6.1, 5.10.1 and 10.0.1).CI changes:
This changes the public API.
Assigning to an rvalue Kvs or KvsValue no longer compiles. KvsValue::GetValue on a temporary returns a value instead of a reference. The size of KvsValue::Type changes, which affects the ABI.