Closed ethanjli closed 3 years ago
@akdhawan Can you try running your local installation of clang-tidy (version 12) on this branch and report what errors (if any) clang-tidy generates?
@ethanjli After running on my local installation of clang-tidy(version 11) on this branch, I see the following output documented in the output.log output.log
The cppcoreguidelines-pro-type-vararg complaints should be resolvable by modifying the implementation to use array indices rather than deferencing pointers in an iterator style. With only approx. two exceptions (namely the BufferedUART
objects which need to be globals so that they can be referenced in the STM32CubeMX-generated file for interrupt handlers), the cppcoreguidelines-avoid-non-const-global-variables complaints should be resolvable by instantiating everything inside a section in the main function (I'll think more about whether we want to do this tomorrow, but https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Ri-global makes a reasonable argument about initialization orders).
It turns out that actually cppcoreguidelines-pro-type-vararg complaints were a false positive, and we actually do need to work with pointers in an iterator style (because of the C++ std library functions we're using). I've suppressed those complaints. I've also moved non-const global variable declarations into the main
function wherever possible. I ran a quick test uploading this new version of the firmware to my Nucleo board (with the FDO2 driver commented out, since my FDO2 sensor is broken) and it successfully completed setup of the other sensors and was able to send flow measurements to the backend.
@akdhawan Can you try running clang-format and clang-tidy again and report what it outputs? If there are no errors, please go ahead and do an approval through the Github PR's code review interface, and then I'll merge it in.
For records-keeping:
I am going to close this PR for now - we can reopen it later as needed.
This PR:
modernize-make-shared.IncludeStyle
andmodernize-make-unique.IncludeStyle
options by changing them from'0'
(which is not a valid value) tollvm
(which is the default value). For some reason, clang-tidy 10 did not complain about this problem, but clang-tidy 11 does..clang-tidy
configuration compatible with clang-tidy 11main.cpp
by moving the declaration of non-const global variables into the body of themain
function wherever possible.