From 39db9af15b06d566f89735b06020a01e0a5356ab Mon Sep 17 00:00:00 2001 From: Jon Rood Date: Wed, 29 Dec 2021 10:02:40 -0700 Subject: [PATCH] Reintroduce readability-else-after-return check and fix. (#529) --- .clang-tidy | 2 +- amr-wind/physics/VortexRing.cpp | 3 +-- amr-wind/wind_energy/MOData.cpp | 12 +++++------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 75250cc5d6..9140de3e53 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: 'clang-diagnostic-*,clang-analyzer-*,corecppguidelines-*,modernize-*,readability-*,-readability-magic-numbers,-readability-identifier-naming,-modernize-avoid-c-arrays,-modernize-use-trailing-return-type,-readability-named-parameter,-readability-implicit-bool-conversion,-readability-isolate-declaration,-readability-braces-around-statements,-readability-inconsistent-declaration-parameter-name,-modernize-use-emplace,-readability-qualified-auto,-readability-static-accessed-through-instance,-readability-container-size-empty,-readability-make-member-function-const,-readability-uppercase-literal-suffix,-readability-convert-member-functions-to-static,-readability-redundant-member-init,-modernize-use-bool-literals,-readability-const-return-type,-readability-avoid-const-params-in-decls,-modernize-pass-by-value,-modernize-loop-convert,-readability-else-after-return,-readability-simplify-boolean-expr,-clang-analyzer-optin.cplusplus.VirtualCall' +Checks: 'clang-diagnostic-*,clang-analyzer-*,corecppguidelines-*,modernize-*,readability-*,-readability-magic-numbers,-readability-identifier-naming,-modernize-avoid-c-arrays,-modernize-use-trailing-return-type,-readability-named-parameter,-readability-implicit-bool-conversion,-readability-isolate-declaration,-readability-braces-around-statements,-readability-inconsistent-declaration-parameter-name,-modernize-use-emplace,-readability-qualified-auto,-readability-static-accessed-through-instance,-readability-container-size-empty,-readability-make-member-function-const,-readability-uppercase-literal-suffix,-readability-convert-member-functions-to-static,-readability-redundant-member-init,-modernize-use-bool-literals,-readability-const-return-type,-readability-avoid-const-params-in-decls,-modernize-pass-by-value,-modernize-loop-convert,-readability-simplify-boolean-expr,-clang-analyzer-optin.cplusplus.VirtualCall' WarningsAsErrors: '' HeaderFilterRegex: '^((?!/amrex/Src/|/googletest/).)*$' AnalyzeTemporaryDtors: false diff --git a/amr-wind/physics/VortexRing.cpp b/amr-wind/physics/VortexRing.cpp index 931c3d0b40..d4f9012f10 100644 --- a/amr-wind/physics/VortexRing.cpp +++ b/amr-wind/physics/VortexRing.cpp @@ -27,9 +27,8 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real FatCore::operator()( const amrex::Real ssq = std::pow(z, 2) + std::pow(r - R, 2); if (ssq <= Rsq) { return 0.54857674 * Gamma / Rsq * std::exp(-4 * ssq / (Rsq - ssq)); - } else { - return 0.0; } + return 0.0; } AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real CollidingRings::operator()( diff --git a/amr-wind/wind_energy/MOData.cpp b/amr-wind/wind_energy/MOData.cpp index 7fe8f4be27..fc0ceec12b 100644 --- a/amr-wind/wind_energy/MOData.cpp +++ b/amr-wind/wind_energy/MOData.cpp @@ -18,21 +18,19 @@ amrex::Real MOData::calc_psi_m(amrex::Real zeta) const { if (zeta > 0) { return -gamma_m * zeta; - } else { - amrex::Real x = std::sqrt(std::sqrt(1 - beta_m * zeta)); - return 2.0 * std::log(0.5 * (1.0 + x)) + log(0.5 * (1 + x * x)) - - 2.0 * std::atan(x) + utils::half_pi(); } + amrex::Real x = std::sqrt(std::sqrt(1 - beta_m * zeta)); + return 2.0 * std::log(0.5 * (1.0 + x)) + log(0.5 * (1 + x * x)) - + 2.0 * std::atan(x) + utils::half_pi(); } amrex::Real MOData::calc_psi_h(amrex::Real zeta) const { if (zeta > 0) { return -gamma_h * zeta; - } else { - amrex::Real x = std::sqrt(1 - beta_h * zeta); - return 2.0 * std::log(0.5 * (1 + x)); } + amrex::Real x = std::sqrt(1 - beta_h * zeta); + return 2.0 * std::log(0.5 * (1 + x)); } void MOData::update_fluxes(int max_iters)