eclipse-iceoryx / iceoryx

Eclipse iceoryx™ - true zero-copy inter-process-communication
https://iceoryx.io
Apache License 2.0
1.67k stars 390 forks source link

Enable clang-tidy checks and fix warnings in code #1196

Closed elfenpiff closed 2 years ago

elfenpiff commented 2 years ago

Brief feature description

At the moment a lot of clang-tidy checks in our root .clang-tidy file are disabled to ensure that our codebase is at least warning free with a minimal subset of clang-tidy checks.

We should enable the disabled checks one by one and solve the generated warnings in the same step. Some of the warnings require a larger refactoring. If this happens please create another issue and add a todo link in this issue.

ToDo

  1. Remove the compiler warning suppression from all tests, see CMakeLists.txt and the entry set(TEST_CXX_FLAGS PRIVATE ${ICEORYX_WARNINGS} ${ICEORYX_SANITIZER_FLAGS} -Wno-pedantic -Wno-conversion) and fix all warnings.
  2. Create a .clang-tidy file in every test disables warning which originate from the googletest fixtures itself. For instance TEST_F and TYPED_TEST have a rule of 5 warning.

Hints

The .clang-tidy file may have warnings which do not fit for us. If this is the case then please disable the warning and write a justification why this is rule is not appropriate. Example:

* rule: readability-identifier-length
  justification: In some functions single letter variables make sense, this is covered by the review process
  example:
     bad:
       int sum(int summand1, int summand2); // here we would like to have single letter variable arguments
     good:
       int sum(int a, int b); // failure since a and b have less than three letters

CI checks

Files

When a file is stated, it means the header, inline file, cpp file and also the tests are refined.

iceoryx_hoofs/cxx

iceoryx_hoofs/units

iceoryx_hoofs/concurrent

iceoryx_hoofs/rp

posix_wrapper

TODOs after merge of the integration branch

elBoberido commented 2 years ago

@elfenpiff convert is not done yet. clang-tidy does not report warnings because the hpp is not included in the inl. I uncheck the checkbox

elBoberido commented 2 years ago

@elfenpiff I would exclude log and error handler from clang-tidy checks. These will be refactored anyway and there is no need to waste time on it right now.