Remove some NOLINT now that clang-tidy-11 is required
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 15 Jun 2021 04:32:20 +0000 (06:32 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 15 Jun 2021 05:56:32 +0000 (07:56 +0200)
Not all NOLINT can be removed yet, as not all bugs are fixed.

src/gromacs/mdlib/update.cpp
src/gromacs/modularsimulator/propagator.cpp
src/gromacs/trajectoryanalysis/modules/msd.cpp

index 60c3b03535a8ebbe18d7be9030a5cf6b886bec5c..e51f6a355ed90545714e5f15051d3153152b3624 100644 (file)
@@ -381,12 +381,12 @@ updateMDLeapfrogSimple(int                                 start,
             {
                 vNew -= dtPressureCouple * pRVScaleMatrixDiagonal[d] * v[a][d];
             }
-            // TODO: Remove NOLINTs once clang-tidy is updated to v11, it should be able to handle constexpr.
-            if constexpr (storeUpdatedVelocities == StoreUpdatedVelocities::yes) // NOLINT // NOLINTNEXTLINE
+            if constexpr (storeUpdatedVelocities == StoreUpdatedVelocities::yes)
             {
                 v[a][d] = vNew;
             }
-            xprime[a][d] = x[a][d] + vNew * dt; // NOLINT(readability-misleading-indentation)
+            // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
+            xprime[a][d] = x[a][d] + vNew * dt;
         }
     }
 }
@@ -494,13 +494,13 @@ updateMDLeapfrogSimpleSimd(int                               start,
         v1 = fma(f1 * invMass1, timestep, lambdaSystem * v1);
         v2 = fma(f2 * invMass2, timestep, lambdaSystem * v2);
 
-        // TODO: Remove NOLINTs once clang-tidy is updated to v11, it should be able to handle constexpr.
-        if constexpr (storeUpdatedVelocities == StoreUpdatedVelocities::yes) // NOLINT // NOLINTNEXTLINE
+        if constexpr (storeUpdatedVelocities == StoreUpdatedVelocities::yes)
         {
             simdStoreRvecs(v, a, v0, v1, v2);
         }
 
-        SimdReal x0, x1, x2; // NOLINT(readability-misleading-indentation)
+        // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
+        SimdReal x0, x1, x2;
         simdLoadRvecs(x, a, &x0, &x1, &x2);
 
         SimdReal xprime0 = fma(v0, timestep, x0);
index 80b5b20cf6bad5b70efb209e98582cdabe0cfd91..bf819fb323fcacd5b4b31cbe044296a063030368 100644 (file)
@@ -905,13 +905,8 @@ static PropagatorConnection getConnection(Propagator<integrationStage> gmx_unuse
 
     PropagatorConnection propagatorConnection{ propagatorTag };
 
-    // The clang-tidy version on our current CI throws 3 different warnings
-    // for the if constexpr lines, so disable linting for now. Also, this only
-    // works if the brace is on the same line, so turn off clang-format as well
-    // clang-format off
-    // NOLINTNEXTLINE
-    if constexpr (hasStartVelocityScaling<integrationStage>() || hasEndVelocityScaling<integrationStage>()) {
-        // clang-format on
+    if constexpr (hasStartVelocityScaling<integrationStage>() || hasEndVelocityScaling<integrationStage>())
+    {
         propagatorConnection.setNumVelocityScalingVariables =
                 [propagator](int num, ScaleVelocities scaleVelocities) {
                     propagator->setNumVelocityScalingVariables(num, scaleVelocities);
@@ -920,26 +915,20 @@ static PropagatorConnection getConnection(Propagator<integrationStage> gmx_unuse
             return propagator->velocityScalingCallback();
         };
     }
-    // clang-format off
-    // NOLINTNEXTLINE
-    if constexpr (hasStartVelocityScaling<integrationStage>()) {
-        // clang-format on
+    if constexpr (hasStartVelocityScaling<integrationStage>())
+    {
         propagatorConnection.getViewOnStartVelocityScaling = [propagator]() {
             return propagator->viewOnStartVelocityScaling();
         };
     }
-    // clang-format off
-    // NOLINTNEXTLINE
-    if constexpr (hasEndVelocityScaling<integrationStage>()) {
-        // clang-format on
+    if constexpr (hasEndVelocityScaling<integrationStage>())
+    {
         propagatorConnection.getViewOnEndVelocityScaling = [propagator]() {
             return propagator->viewOnEndVelocityScaling();
         };
     }
-    // clang-format off
-    // NOLINTNEXTLINE
-    if constexpr (hasPositionScaling<integrationStage>()) {
-        // clang-format on
+    if constexpr (hasPositionScaling<integrationStage>())
+    {
         propagatorConnection.setNumPositionScalingVariables = [propagator](int num) {
             propagator->setNumPositionScalingVariables(num);
         };
@@ -950,10 +939,8 @@ static PropagatorConnection getConnection(Propagator<integrationStage> gmx_unuse
             return propagator->positionScalingCallback();
         };
     }
-    // clang-format off
-    // NOLINTNEXTLINE
-    if constexpr (hasParrinelloRahmanScaling<integrationStage>()) {
-        // clang-format on
+    if constexpr (hasParrinelloRahmanScaling<integrationStage>())
+    {
         propagatorConnection.getViewOnPRScalingMatrix = [propagator]() {
             return propagator->viewOnPRScalingMatrix();
         };
@@ -962,7 +949,6 @@ static PropagatorConnection getConnection(Propagator<integrationStage> gmx_unuse
         };
     }
 
-    // NOLINTNEXTLINE(readability-misleading-indentation)
     return propagatorConnection;
 }
 
index 2c7479bc388d191d53b03767e7da41d614aa903f..beae64d65e997c07c119c284dab0d0da6cf5f7d5 100644 (file)
@@ -171,19 +171,22 @@ inline double calcSingleSquaredDistance(const RVec c1, const RVec c2)
     const DVec firstCoords  = c1.toDVec();
     const DVec secondCoords = c2.toDVec();
     double     result       = 0;
-    if constexpr (x) // NOLINT // NOLINTNEXTLINE
+    if constexpr (x)
     {
         result += (firstCoords[XX] - secondCoords[XX]) * (firstCoords[XX] - secondCoords[XX]);
     }
-    if constexpr (y) // NOLINT // NOLINTNEXTLINE
+    // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
+    if constexpr (y)
     {
         result += (firstCoords[YY] - secondCoords[YY]) * (firstCoords[YY] - secondCoords[YY]);
     }
-    if constexpr (z) // NOLINT // NOLINTNEXTLINE
+    // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
+    if constexpr (z)
     {
         result += (firstCoords[ZZ] - secondCoords[ZZ]) * (firstCoords[ZZ] - secondCoords[ZZ]);
     }
-    return result; // NOLINT
+    // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
+    return result;
 }
 
 /*! \brief Calculate average displacement between sets of points