Skip to content

Atomic lint filtering

hgratten requested to merge atomic_lint_filtering into master

this merge request introduces the clang-tidied filtering chapter

LectureCodes/Filtering/*

  • removed cmake_minimum_required(VERSION 2.8), since the cmake version is better handled by the global CMakeLists.txt file
  • put functions in header files in a separate namespace if there are using directives, to avoid clutter in the global namespace and clarify dependencies in main files
  • inlined functions in header file to avoid potential ODR (one-definition-rule) violations: since functions are defined directly in the header, including it from multiple translation units would cause multiple definitions, which inlining avoids by duplicating the definition per translation unit
  • avoided multiple declarations in a single line for readability
  • integer type hygiene (use Eigen::Index for indexing)
  • wrapped body statement of for, do while, and while in braces. increases readability and forgetting braces is a common source of bugs for students.
  • introduced const wherever possible
  • explicitly casted integer types to double
  • replaced typedef with using alias. typedef is deprecated, since it cannot handle templated type aliases. however, the semantics for non-templated statements are identical between the two.
  • removed "using namespace", since it clutters the translation unit, instead explicitly introduced individual symbols via using
  • ignored locally bugprone-exception-escape: a subroutine (e.g. deblur) may throw an exception, but in this case we want the program to exit
  • ignored locally misc-no-recursion: in this case the recursion is not a possible bug but the whole idea behind the algorithm
  • reordered includes as good practice (user header first, then system headers, ordered alphabetically
  • replaced comma operator assert expression with logical && style assert expression: comma operators with side-effect free left hand sides (such as string literals) produce warnings and are regarded as a common sourc of bugs by c++ compilers

Merge request reports

Loading