OpenCyphal-Garage / libcyphal

Portable reference implementation of the Cyphal protocol stack in C++ for embedded systems and Linux.
http://opencyphal.org
MIT License
292 stars 502 forks source link

Clang tidy & sonar integration and corresponding fixes. #358

Closed serges147 closed 4 months ago

serges147 commented 4 months ago

GitHub's "Hide whitespace" is recommended during review.

image image
serges147 commented 4 months ago

I wonder if we should disable the no-magic-numbers rules? Magic numbers may be a problem in numerical code but this is not the case here.

I disabled them at unit tests. Production code still under this "no-magic-numbers" rule with following exceptions in the .clang-tidy file:

  - key:   readability-magic-numbers.IgnoredIntegerValues
    value: '1;2;3;4;5;8;10;16;20;32;60;64;100;128;256;500;512;1000'

I don't like the suppression comments near the type_id_type definitions.

clang-format makes code quite ugly if you put such NOLINT at the same line as id bytes... so I found that NOLINTNEXTLINE is better IMO (but you cannot put it before using ...) - I wish there was NOLINTPREVIOUSLINE thing...

sonarcloud[bot] commented 4 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
2 Accepted issues

Measures
0 Security Hotspots
98.8% Coverage on New Code
1.2% Duplication on New Code

See analysis details on SonarCloud