diff --git a/.gitlab-ci/default.yml b/.gitlab-ci/default.yml index 3e8fcf3ecb11005f39230b9a60fea4d842b54524..db781662b325d1599ba9d646e0421ce040f48030 100644 --- a/.gitlab-ci/default.yml +++ b/.gitlab-ci/default.yml @@ -51,6 +51,7 @@ black (python): stage: linting script: # only check the python folder for now (Python code related to bindings) + - black --version - black --check --verbose -- python - black --check --verbose -- test/python - black --check --verbose -- bin @@ -92,9 +93,10 @@ codespell: cppcheck: stage: linting script: - - cppcheck -j8 --error-exitcode=1 --inline-suppr -idumux/io/format/fmt/ --enable=missingInclude --project=build-cmake/compile_commands.json --suppress=*:*/dune/* --suppress=*:dumux/io/format/fmt/* - - cppcheck -j8 --error-exitcode=1 --inline-suppr -idumux/io/format/fmt/ --suppress=*:*/dune/* --suppress=*:dumux/io/format/fmt/* test - - cppcheck -j8 --error-exitcode=1 --inline-suppr -idumux/io/format/fmt/ --suppress=*:*/dune/* --suppress=*:dumux/io/format/fmt/* examples + - cppcheck --version + - cppcheck -j8 --error-exitcode=1 --inline-suppr -iformat/fmt/ --enable=missingInclude --project=build-cmake/compile_commands.json --suppress=*:*/dune/* --suppress=*:*/fmt/* --suppress=*:*/xml/* --suppress=*:*/json/* + - cppcheck -j8 --error-exitcode=1 --max-configs=1 --inline-suppr -iformat/fmt/ -I ${CI_PROJECT_DIR} --suppress=*:*/dune/* --suppress=*:*/fmt/* --suppress=*:*/xml/* --suppress=*:*/json/* test + - cppcheck -j8 --error-exitcode=1 --max-configs=1 --inline-suppr -iformat/fmt/ -I ${CI_PROJECT_DIR} --suppress=*:*/dune/* --suppress=*:*/fmt/* --suppress=*:*/xml/* --suppress=*:*/json/* examples needs: - job: configure artifacts: true diff --git a/dumux/common/tag.hh b/dumux/common/tag.hh index d95428a79fc8076c69ccbfb33852614ece700f98..776631a2641acc8483d5ab52f0907272f2b0c559 100644 --- a/dumux/common/tag.hh +++ b/dumux/common/tag.hh @@ -51,6 +51,7 @@ inline constexpr bool operator!=(Tag<T1>, Tag<T2>) { return !std::is_same_v<T1, T2>; } namespace Detail { +// cppcheck-suppress internalAstError constexpr auto hasName = isValid([](auto&& t) -> decltype(t.name(), void()) {}); } // end namespace Detail diff --git a/dumux/io/grid/porenetwork/structuredlatticegridcreator.hh b/dumux/io/grid/porenetwork/structuredlatticegridcreator.hh index d4aef9f377d312eebb02e2a002c1e1a86445c2a4..e528ca4df99df422e5c057e0dda4bfd7c4f5ffc3 100644 --- a/dumux/io/grid/porenetwork/structuredlatticegridcreator.hh +++ b/dumux/io/grid/porenetwork/structuredlatticegridcreator.hh @@ -95,7 +95,7 @@ public: init(useAllElements, paramGroup); } - template<class LowDimElementSelector, + template<class LowDimElementSelector, // cppcheck-suppress syntaxError typename std::enable_if_t<Dune::models<Concept::LowDimElementSelector<GlobalPosition>, LowDimElementSelector>(), int> = 0> void init(const LowDimElementSelector& lowDimElementSelector, const std::string& paramGroup = "") diff --git a/dumux/material/fluidsystems/h2oair.hh b/dumux/material/fluidsystems/h2oair.hh index baebf0bb47024329969c9b3c197e66f4bd534ed0..2d5eb449529ac56e306a11b6ebd4ac184646626b 100644 --- a/dumux/material/fluidsystems/h2oair.hh +++ b/dumux/material/fluidsystems/h2oair.hh @@ -281,7 +281,8 @@ public: if (compIdx == H2OIdx) { const auto t = fluidState.temperature(H2OIdx); - if (!useKelvinVaporPressure) + // cppcheck-suppress internalAstError + if constexpr (!useKelvinVaporPressure) return H2O::vaporPressure(t); else { diff --git a/dumux/material/fluidsystems/h2on2kinetic.hh b/dumux/material/fluidsystems/h2on2kinetic.hh index bf1070f7fe1e91b78c882087bb501370b92788b1..7133a06857e6069fce5b5b4196131238c73a0b2f 100644 --- a/dumux/material/fluidsystems/h2on2kinetic.hh +++ b/dumux/material/fluidsystems/h2on2kinetic.hh @@ -69,36 +69,28 @@ public: const Scalar T = fluidState.temperature(phaseIdx); const Scalar p = fluidState.pressure(phaseIdx); - switch (phaseIdx){ + switch (phaseIdx) { case ParentType::liquidPhaseIdx: - switch(compIdx){ - case ParentType::H2OIdx: - return ParentType::H2O::liquidEnthalpy(T, p); - case ParentType::N2Idx: - return ParentType::N2::gasEnthalpy(T, p); // TODO: should be liquid enthalpy - default: - DUNE_THROW(Dune::NotImplemented, - "wrong index"); - break; - }// end switch compIdx - break; + switch(compIdx) { + case ParentType::H2OIdx: + return ParentType::H2O::liquidEnthalpy(T, p); + case ParentType::N2Idx: + return ParentType::N2::gasEnthalpy(T, p); // TODO: should be liquid enthalpy + default: + DUNE_THROW(Dune::NotImplemented, "wrong index"); + } case ParentType::gasPhaseIdx: - switch(compIdx){ - case ParentType::H2OIdx: - return ParentType::H2O::gasEnthalpy(T, p); - case ParentType::N2Idx: - return ParentType::N2::gasEnthalpy(T, p); - default: - DUNE_THROW(Dune::NotImplemented, - "wrong index"); - break; - }// end switch compIdx - break; + switch(compIdx) { + case ParentType::H2OIdx: + return ParentType::H2O::gasEnthalpy(T, p); + case ParentType::N2Idx: + return ParentType::N2::gasEnthalpy(T, p); + default: + DUNE_THROW(Dune::NotImplemented, "wrong index"); + } default: - DUNE_THROW(Dune::NotImplemented, - "wrong index"); - break; - }// end switch phaseIdx + DUNE_THROW(Dune::NotImplemented, "wrong index"); + } } /*!