Repository navigation
Add explicit keyword to constructors - #281
thekurtovic wants to merge 4 commits into
Conversation
|
LogAlso Do you think it's better to just create a new constructor which can take a uint16_t, or change such instances like this? I've gone with the latter (though I excluded the file from the commit for now), though adding the new constructor would probably make it easier to read Edit: Or this |
|
I think |
|
Would this be considered a breaking change? Any applications making use of these implicit conversions will fail to compile, though the changes should be easy to make. |
|
It might be, depending on the application. I would suggest adding the HID changes to this PR so we can test the builds at least. Maybe add some more build tests to find where it may fail so it can be documented? |
d307e00 to
f9afdc9
Compare
Resolves cppcheck warnings noExplicitConstructor, and useInitializationList.
c029c5f to
6ab0376
Compare
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Explicit constructor declarations src/NimBLEUUID.h, src/NimBLE2904.h, src/NimBLEAddress.h, src/NimBLEAttValue.h, src/NimBLECharacteristic.h, src/NimBLEConnInfo.h, src/NimBLEService.h, src/NimBLEClient.h, src/NimBLEExtAdvertising.h, src/NimBLEHIDDevice.h |
Arr, constructors across these public types are now explicit. NimBLEAttValue string and vector constructors now accept const references. NimBLEUUID constructor declarations are reordered without signature changes. |
Explicit UUID and address call sites src/NimBLEHIDDevice.cpp, src/NimBLERemoteService.cpp, src/NimBLERemoteValueAttribute.h, src/NimBLEClient.cpp |
Affected call sites now construct NimBLEUUID objects for UUID arguments and NimBLEAddress objects for disconnect-event fallback lookups. Existing UUIDs, properties, lookup order, and null checks remain unchanged. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Other
Suggested reviewers: h2zero
Merge Risk: 
Minimal · up to 6fbcb
-
No merge-blocking issue is established. Explicit constructors intentionally restrict implicit conversions, so applications relying on those conversions may need call-site updates.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
Arr, the title be clear and on target. "Add explicit keyword to constructors" names the main change: the constructors across the NimBLE headers now carry the explicit keyword to block implicit conversions. The title is short, specific, and matches the PR objectives, which target the noExplicitConstructor warnings. Aye, it does not list the supporting edits in NimBLEHIDDevice.cpp or NimBLEAttValue.h, but it need not do so.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 84.21% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 19 functions across 14 files.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Arr, conversions now sail with a clear type,
UUIDs are wrapped at each call site,
Const references pass strings and vectors along,
The lookup order stays steady and strong,
Explicit constructors keep the course right.
Comment @coderabbitai help to get the list of available commands.
Resolves cppcheck warnings noExplicitConstructor, useInitializationList, and passedByValue.
Summary by CodeRabbit