Skip to content

Commit

Permalink
Update cpp-linter.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanwm authored Jul 25, 2024
1 parent 28f99bf commit e8ac238
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cpp-linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: "Microsoft"
ignore: '.github|_deps'
format-review: true
tidy-review: true
files-changed-only: false
Expand Down

1 comment on commit e8ac238

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format reports: 2 file(s) not formatted
  • CMakeFiles/3.30.1/CompilerIdCXX/CMakeCXXCompilerId.cpp
  • CMakeFiles/3.30.1/CompilerIdC/CMakeCCompilerId.c
clang-tidy reports: 256 concern(s)
  • tests/barger-propagator.hpp:3:10: warning: [modernize-deprecated-headers]

    inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead

    #include <math.h>
             ^~~~~~~~
             <cmath>
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:28:93: warning: 999.9 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        inline void setParams(float m1, float m2, float theta, float baseline, float density = -999.9)
                                                                                                ^
  • tests/barger-propagator.hpp:38:18: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        inline float lv(float energy)
               ~~~~~ ^
               auto                   -> float
  • tests/barger-propagator.hpp:38:18: warning: [readability-make-member-function-const]

    method 'lv' can be made const

        inline float lv(float energy)
                     ^
                                      const
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:40:16: warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
            return 4.0 * M_PI * energy / (_m1 * _m1 - _m2 * _m2);
                   ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:40:16: warning: 4.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
  • tests/barger-propagator.hpp:44:18: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        inline float lm()
               ~~~~~ ^
               auto       -> float
  • tests/barger-propagator.hpp:44:18: warning: [readability-make-member-function-const]

    method 'lm' can be made const

        inline float lm()
                     ^
                          const
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:46:16: warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
            return 2.0 * M_PI / (Constants::Groot2 * _density);
                   ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:46:16: warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
  • tests/barger-propagator.hpp:50:18: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        inline float calculateEffectiveAngle(float energy)
               ~~~~~ ^
               auto                                        -> float
  • tests/barger-propagator.hpp:52:28: warning: [readability-braces-around-statements]

    statement should be inside braces

            if (_density > 0.0)
                               ^
                                {
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:53:20: warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
                return std::atan2(std::sin(2.0 * _theta), (std::cos(2.0 * _theta) - lv(energy) / lm())) / 2.0;
                       ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:53:40: warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
                return std::atan2(std::sin(2.0 * _theta), (std::cos(2.0 * _theta) - lv(energy) / lm())) / 2.0;
                                           ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:53:65: warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
                return std::atan2(std::sin(2.0 * _theta), (std::cos(2.0 * _theta) - lv(energy) / lm())) / 2.0;
                                                                    ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:53:103: warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
                return std::atan2(std::sin(2.0 * _theta), (std::cos(2.0 * _theta) - lv(energy) / lm())) / 2.0;
                                                                                                          ^
  • tests/barger-propagator.hpp:54:9: warning: [readability-else-after-return]

    do not use 'else' after 'return'

            else
            ^~~~
                        return _theta
  • tests/barger-propagator.hpp:54:13: warning: [readability-braces-around-statements]

    statement should be inside braces

            else
                ^
    note: this fix will not be applied because it overlaps with another fix
  • tests/barger-propagator.hpp:59:18: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        inline float calculateEffectiveDm2(float energy)
               ~~~~~ ^
               auto                                      -> float
  • tests/barger-propagator.hpp:61:28: warning: [readability-braces-around-statements]

    statement should be inside braces

            if (_density > 0.0)
                               ^
                                {
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:62:20: warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
                return (_m1 * _m1 - _m2 * _m2) * std::sqrt(1.0 - 2.0 * (lv(energy) / lm()) * std::cos(2.0 * _theta) +
                       ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:62:62: warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
                return (_m1 * _m1 - _m2 * _m2) * std::sqrt(1.0 - 2.0 * (lv(energy) / lm()) * std::cos(2.0 * _theta) +
                                                                 ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:62:99: warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
                return (_m1 * _m1 - _m2 * _m2) * std::sqrt(1.0 - 2.0 * (lv(energy) / lm()) * std::cos(2.0 * _theta) +
                                                                                                      ^
  • tests/barger-propagator.hpp:64:9: warning: [readability-else-after-return]

    do not use 'else' after 'return'

            else
            ^~~~
                        return (_m1 * _m1 - _m2 * _m2)
  • tests/barger-propagator.hpp:64:13: warning: [readability-braces-around-statements]

    statement should be inside braces

            else
                ^
    note: this fix will not be applied because it overlaps with another fix
  • tests/barger-propagator.hpp:69:18: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        inline float getPMNSelement(float energy, int alpha, int beta)
               ~~~~~ ^
               auto                                                    -> float
  • tests/barger-propagator.hpp:83:37: warning: [readability-braces-around-statements]

    statement should be inside braces

            if (alpha == 0 && beta == 0)
                                        ^
                                         {
  • tests/barger-propagator.hpp:84:13: warning: [bugprone-branch-clone]

    repeated branch in conditional chain

                return std::cos(gamma);
                ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:84:35: note: end of the original
                return std::cos(gamma);
                                      ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:86:13: note: clone 1 starts here
                return std::cos(gamma);
                ^
  • tests/barger-propagator.hpp:85:9: warning: [readability-else-after-return]

    do not use 'else' after 'return'

            else if (alpha == 1 && beta == 1)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • tests/barger-propagator.hpp:85:42: warning: [readability-braces-around-statements]

    statement should be inside braces

            else if (alpha == 1 && beta == 1)
                                             ^
    note: this fix will not be applied because it overlaps with another fix
  • tests/barger-propagator.hpp:87:42: warning: [readability-braces-around-statements]

    statement should be inside braces

            else if (alpha == 0 && beta == 1)
                                             ^
    note: this fix will not be applied because it overlaps with another fix
  • tests/barger-propagator.hpp:89:42: warning: [readability-braces-around-statements]

    statement should be inside braces

            else if (alpha == 1 && beta == 0)
                                             ^
    note: this fix will not be applied because it overlaps with another fix
  • tests/barger-propagator.hpp:101:18: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        inline float calculateProb(float energy, int alpha, int beta)
               ~~~~~ ^
               auto                                                   -> float
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:120:27: warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
            float sin2Gamma = std::sin(2.0 * gamma);
                              ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:120:36: warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            float sin2Gamma = std::sin(2.0 * gamma);
                                       ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:121:24: warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
            float sinPhi = std::sin(dM2 * _baseline / (4.0 * energy));
                           ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:121:52: warning: 4.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            float sinPhi = std::sin(dM2 * _baseline / (4.0 * energy));
                                                       ^
    /home/runner/work/nuTens/nuTens/tests/barger-propagator.hpp:124:24: warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
            float onAxis = 1.0 - offAxis;
                           ^
  • tests/barger-propagator.hpp:126:27: warning: [readability-braces-around-statements]

    statement should be inside braces

            if (alpha == beta)
                              ^
                               {
  • tests/barger-propagator.hpp:128:9: warning: [readability-else-after-return]

    do not use 'else' after 'return'

            else
            ^~~~
                        return offAxis
  • tests/barger-propagator.hpp:128:13: warning: [readability-braces-around-statements]

    statement should be inside braces

            else
                ^
    note: this fix will not be applied because it overlaps with another fix
  • tests/test-utils.hpp:3:10: warning: [modernize-deprecated-headers]

    inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead

    #include <math.h>
             ^~~~~~~~
             <cmath>
  • tests/test-utils.hpp:14:7: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

    float relativeDiff(float f1, float f2)
    ~~~~~ ^
    auto                                   -> float
  • tests/test-utils.hpp:28:9: warning: [cppcoreguidelines-macro-usage]

    function-like macro 'TEST_EXPECTED' used; consider a 'constexpr' template function

    #define TEST_EXPECTED(value, expectation, varName, threshold)                                                          \
            ^
  • tests/test-utils.hpp:30:57: warning: [bugprone-macro-parentheses]

    macro argument should be enclosed in parentheses

            if (Testing::relativeDiff(value, expectation) > threshold)                                                     \
                                                            ^
                                                            (        )
  • tests/test-utils.hpp:32:36: warning: [bugprone-macro-parentheses]

    macro argument should be enclosed in parentheses

                std::cerr << "bad " << varName << std::endl;                                                               \
                                       ^
                                       (      )
  • tests/test-utils.hpp:33:37: warning: [bugprone-macro-parentheses]

    macro argument should be enclosed in parentheses

                std::cerr << "Got: " << value;                                                                             \
                                        ^
                                        (    )
  • tests/test-utils.hpp:34:44: warning: [bugprone-macro-parentheses]

    macro argument should be enclosed in parentheses

                std::cerr << "; Expected: " << expectation;                                                                \
                                               ^
                                               (          )
  • nuTens/logging.hpp:12:9: warning: [cppcoreguidelines-macro-usage]

    macro 'NT_LOG_LEVEL_TRACE' used to declare a constant; consider using a 'constexpr' constant

    #define NT_LOG_LEVEL_TRACE 0
            ^
  • nuTens/logging.hpp:13:9: warning: [cppcoreguidelines-macro-usage]

    macro 'NT_LOG_LEVEL_DEBUG' used to declare a constant; consider using a 'constexpr' constant

    #define NT_LOG_LEVEL_DEBUG 1
            ^
  • nuTens/logging.hpp:14:9: warning: [cppcoreguidelines-macro-usage]

    macro 'NT_LOG_LEVEL_INFO' used to declare a constant; consider using a 'constexpr' constant

    #define NT_LOG_LEVEL_INFO 2
            ^
  • nuTens/logging.hpp:15:9: warning: [cppcoreguidelines-macro-usage]

    macro 'NT_LOG_LEVEL_WARNING' used to declare a constant; consider using a 'constexpr' constant

    #define NT_LOG_LEVEL_WARNING 3
            ^
  • nuTens/logging.hpp:16:9: warning: [cppcoreguidelines-macro-usage]

    macro 'NT_LOG_LEVEL_ERROR' used to declare a constant; consider using a 'constexpr' constant

    #define NT_LOG_LEVEL_ERROR 4
            ^
  • nuTens/logging.hpp:17:9: warning: [cppcoreguidelines-macro-usage]

    macro 'NT_LOG_LEVEL_SILENT' used to declare a constant; consider using a 'constexpr' constant

    #define NT_LOG_LEVEL_SILENT 5
            ^
  • nuTens/logging.hpp:21:9: warning: [cppcoreguidelines-macro-usage]

    macro 'SPDLOG_ACTIVE_LEVEL' used to declare a constant; consider using a 'constexpr' constant

    #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
            ^
  • nuTens/logging.hpp:41:10: error: [clang-diagnostic-error]

    'spdlog/spdlog.h' file not found

    #include "spdlog/spdlog.h"
             ^
  • nuTens/logging.hpp:48:34: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'runtimeLogLevel' is non-const and globally accessible, consider making it const

    static spdlog::level::level_enum runtimeLogLevel = spdlog::level::trace;
                                     ^
  • nuTens/logging.hpp:67:23: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'once' is non-const and globally accessible, consider making it const

    static std::once_flag once;
                          ^
  • nuTens/logging.hpp:84:9: warning: [cppcoreguidelines-macro-usage]

    variadic macro 'NT_TRACE' used; consider using a 'constexpr' variadic template function

    #define NT_TRACE(...)                                                                                                  \
            ^
  • nuTens/logging.hpp:92:9: warning: [cppcoreguidelines-macro-usage]

    variadic macro 'NT_DEBUG' used; consider using a 'constexpr' variadic template function

    #define NT_DEBUG(...)                                                                                                  \
            ^
  • nuTens/logging.hpp:100:9: warning: [cppcoreguidelines-macro-usage]

    variadic macro 'NT_INFO' used; consider using a 'constexpr' variadic template function

    #define NT_INFO(...)                                                                                                   \
            ^
  • nuTens/logging.hpp:108:9: warning: [cppcoreguidelines-macro-usage]

    variadic macro 'NT_WARN' used; consider using a 'constexpr' variadic template function

    #define NT_WARN(...)                                                                                                   \
            ^
  • nuTens/logging.hpp:116:9: warning: [cppcoreguidelines-macro-usage]

    variadic macro 'NT_ERROR' used; consider using a 'constexpr' variadic template function

    #define NT_ERROR(...)                                                                                                  \
            ^
  • nuTens/nuTens-pch.hpp:3:10: warning: [modernize-deprecated-headers]

    inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead

    #include <math.h>
             ^~~~~~~~
             <cmath>
  • nuTens/tensors/tensor.hpp:47:13: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor &ones(int length, NTdtypes::scalarType type, NTdtypes::deviceType device = NTdtypes::kCPU,
        ~~~~~~~~^
        auto 
  • nuTens/tensors/tensor.hpp:52:13: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor &ones(const std::vector<long int> &shape, NTdtypes::scalarType type,
        ~~~~~~~~^
        auto 
  • nuTens/tensors/tensor.hpp:58:13: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor &zeros(int length, NTdtypes::scalarType type, NTdtypes::deviceType device = NTdtypes::kCPU,
        ~~~~~~~~^
        auto 
  • nuTens/tensors/tensor.hpp:63:13: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor &zeros(const std::vector<long int> &shape, NTdtypes::scalarType type,
        ~~~~~~~~^
        auto 
  • nuTens/tensors/tensor.hpp:71:13: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor &dType(NTdtypes::scalarType type);
        ~~~~~~~~^
        auto                                     -> Tensor &
  • nuTens/tensors/tensor.hpp:73:13: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor &device(NTdtypes::deviceType device);
        ~~~~~~~~^
        auto                                        -> Tensor &
  • nuTens/tensors/tensor.hpp:75:13: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor &requiresGrad(bool reqGrad);
        ~~~~~~~~^
        auto                               -> Tensor &
  • nuTens/tensors/tensor.hpp:87:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static Tensor matmul(const Tensor &t1, const Tensor &t2);
               ~~~~~~ ^
               auto                                              -> Tensor
  • nuTens/tensors/tensor.hpp:92:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static Tensor outer(const Tensor &t1, const Tensor &t2);
               ~~~~~~ ^
               auto                                             -> Tensor
  • nuTens/tensors/tensor.hpp:97:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static Tensor mul(const Tensor &t1, const Tensor &t2);
               ~~~~~~ ^
               auto                                           -> Tensor
  • nuTens/tensors/tensor.hpp:102:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static Tensor div(const Tensor &t1, const Tensor &t2);
               ~~~~~~ ^
               auto                                           -> Tensor
  • nuTens/tensors/tensor.hpp:107:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static Tensor pow(const Tensor &t, float s);
               ~~~~~~ ^
               auto                                 -> Tensor
  • nuTens/tensors/tensor.hpp:111:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static Tensor pow(const Tensor &t, std::complex<float> s);
               ~~~~~~ ^
               auto                                               -> Tensor
  • nuTens/tensors/tensor.hpp:115:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static Tensor exp(const Tensor &t);
               ~~~~~~ ^
               auto                        -> Tensor
  • nuTens/tensors/tensor.hpp:121:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static Tensor transpose(const Tensor &t, int dim1, int dim2);
               ~~~~~~ ^
               auto                                                  -> Tensor
  • nuTens/tensors/tensor.hpp:126:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static Tensor scale(const Tensor &t, float s);
               ~~~~~~ ^
               auto                                   -> Tensor
  • nuTens/tensors/tensor.hpp:130:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static Tensor scale(const Tensor &t, std::complex<float> s);
               ~~~~~~ ^
               auto                                                 -> Tensor
  • nuTens/tensors/tensor.hpp:187:10: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        bool operator==(const Tensor &rhs) const;
        ~~~~ ^
        auto                                     -> bool
  • nuTens/tensors/tensor.hpp:188:10: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        bool operator!=(const Tensor &rhs) const;
        ~~~~ ^
        auto                                     -> bool
  • nuTens/tensors/tensor.hpp:189:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor operator+(const Tensor &rhs) const;
        ~~~~~~ ^
        auto                                      -> Tensor
  • nuTens/tensors/tensor.hpp:190:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor operator-(const Tensor &rhs) const;
        ~~~~~~ ^
        auto                                      -> Tensor
  • nuTens/tensors/tensor.hpp:191:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor operator-() const;
        ~~~~~~ ^
        auto                     -> Tensor
  • nuTens/tensors/tensor.hpp:195:5: warning: [modernize-use-nodiscard]

    function 'real' should be marked [[nodiscard]]

        Tensor real() const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:195:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor real() const;
        ~~~~~~ ^
        auto                -> Tensor
  • nuTens/tensors/tensor.hpp:197:5: warning: [modernize-use-nodiscard]

    function 'imag' should be marked [[nodiscard]]

        Tensor imag() const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:197:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor imag() const;
        ~~~~~~ ^
        auto                -> Tensor
  • nuTens/tensors/tensor.hpp:200:5: warning: [modernize-use-nodiscard]

    function 'conj' should be marked [[nodiscard]]

        Tensor conj() const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:200:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor conj() const;
        ~~~~~~ ^
        auto                -> Tensor
  • nuTens/tensors/tensor.hpp:202:5: warning: [modernize-use-nodiscard]

    function 'abs' should be marked [[nodiscard]]

        Tensor abs() const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:202:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor abs() const;
        ~~~~~~ ^
        auto               -> Tensor
  • nuTens/tensors/tensor.hpp:204:5: warning: [modernize-use-nodiscard]

    function 'angle' should be marked [[nodiscard]]

        Tensor angle() const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:204:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor angle() const;
        ~~~~~~ ^
        auto                 -> Tensor
  • nuTens/tensors/tensor.hpp:208:5: warning: [modernize-use-nodiscard]

    function 'cumsum' should be marked [[nodiscard]]

        Tensor cumsum(int dim) const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:208:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor cumsum(int dim) const;
        ~~~~~~ ^
        auto                         -> Tensor
  • nuTens/tensors/tensor.hpp:211:5: warning: [modernize-use-nodiscard]

    function 'sum' should be marked [[nodiscard]]

        Tensor sum() const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:211:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor sum() const;
        ~~~~~~ ^
        auto               -> Tensor
  • nuTens/tensors/tensor.hpp:222:5: warning: [modernize-use-nodiscard]

    function 'grad' should be marked [[nodiscard]]

        Tensor grad() const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:222:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor grad() const;
        ~~~~~~ ^
        auto                -> Tensor
  • nuTens/tensors/tensor.hpp:231:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static Tensor sin(const Tensor &t);
               ~~~~~~ ^
               auto                        -> Tensor
  • nuTens/tensors/tensor.hpp:235:19: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static Tensor cos(const Tensor &t);
               ~~~~~~ ^
               auto                        -> Tensor
  • nuTens/tensors/tensor.hpp:241:26: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        friend std::ostream &operator<<(std::ostream &stream, const Tensor &tensor)
               ~~~~~~~~~~~~~~^
               auto                                                                 -> std::ostream &
  • nuTens/tensors/tensor.hpp:247:5: warning: [modernize-use-nodiscard]

    function 'toString' should be marked [[nodiscard]]

        std::string toString() const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:247:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        std::string toString() const;
        ~~~~~~~~~~~ ^
        auto                         -> std::string
  • nuTens/tensors/tensor.hpp:259:5: warning: [modernize-use-nodiscard]

    function 'getValue' should be marked [[nodiscard]]

        Tensor getValue(const std::vector<std::variant<int, std::string>> &indices) const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:259:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor getValue(const std::vector<std::variant<int, std::string>> &indices) const;
        ~~~~~~ ^
        auto                                                                              -> Tensor
  • nuTens/tensors/tensor.hpp:262:5: warning: [modernize-use-nodiscard]

    function 'getNdim' should be marked [[nodiscard]]

        size_t getNdim() const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:262:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        size_t getNdim() const;
        ~~~~~~ ^
        auto                   -> size_t
  • nuTens/tensors/tensor.hpp:265:5: warning: [modernize-use-nodiscard]

    function 'getBatchDim' should be marked [[nodiscard]]

        int getBatchDim() const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:265:9: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        int getBatchDim() const;
        ~~~ ^
        auto                    -> int
  • nuTens/tensors/tensor.hpp:268:5: warning: [modernize-use-nodiscard]

    function 'getShape' should be marked [[nodiscard]]

        std::vector<int> getShape() const;
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:268:22: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        std::vector<int> getShape() const;
        ~~~~~~~~~~~~~~~~ ^
        auto                              -> std::vector<int>
  • nuTens/tensors/tensor.hpp:274:36: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        template <typename T> inline T getValue(const std::vector<int> &indices)
                                     ~ ^
                                     auto                                        -> T
  • nuTens/tensors/tensor.hpp:277:9: warning: [modernize-loop-convert]

    use range-based for loop instead

            for (size_t i = 0; i < indices.size(); i++)
            ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                (int indice : indices)
  • nuTens/tensors/tensor.hpp:279:24: warning: [modernize-use-emplace]

    use emplace_back instead of push_back

                indicesVec.push_back(at::indexing::TensorIndex(indices[i]));
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~          ~
                           emplace_back(
  • nuTens/tensors/tensor.hpp:286:36: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        template <typename T> inline T getValue()
                                     ~ ^
                                     auto         -> T
  • nuTens/tensors/tensor.hpp:293:24: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        static std::string getTensorLibrary();
               ~~~~~~~~~~~ ^
               auto                           -> std::string
  • nuTens/tensors/tensor.hpp:296:3: warning: [readability-redundant-access-specifiers]

    redundant access specifier has the same accessibility as the previous access specifier

      public:
      ^~~~~~~
    /home/runner/work/nuTens/nuTens/nuTens/tensors/tensor.hpp:39:3: note: previously declared here
      public:
      ^
  • nuTens/tensors/tensor.hpp:297:5: warning: [modernize-use-nodiscard]

    function 'getTensor' should be marked [[nodiscard]]

        inline const torch::Tensor &getTensor() const
        ^
        [[nodiscard]] 
  • nuTens/tensors/tensor.hpp:297:33: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        inline const torch::Tensor &getTensor() const
               ~~~~~~~~~~~~~~~~~~~~~^
               auto                                   -> const torch::Tensor &
  • nuTens/tensors/tensor.hpp:303:19: warning: [cppcoreguidelines-non-private-member-variables-in-classes]

    member variable '_tensor' has protected visibility

        torch::Tensor _tensor;
                      ^
  • nuTens/propagator/propagator.hpp:34:5: warning: [modernize-use-nodiscard]

    function 'calculateProbs' should be marked [[nodiscard]]

        Tensor calculateProbs(const Tensor &energies) const;
        ^
        [[nodiscard]] 
  • nuTens/propagator/propagator.hpp:34:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor calculateProbs(const Tensor &energies) const;
        ~~~~~~ ^
        auto                                                -> Tensor
  • nuTens/propagator/propagator.hpp:60:38: warning: [readability-braces-around-statements]

    statement should be inside braces

            if (_matterSolver != nullptr)
                                         ^
                                          {
  • nuTens/propagator/propagator.hpp:69:38: warning: [readability-braces-around-statements]

    statement should be inside braces

            if (_matterSolver != nullptr)
                                         ^
                                          {
  • nuTens/propagator/propagator.hpp:98:5: warning: [modernize-use-nodiscard]

    function '_calculateProbs' should be marked [[nodiscard]]

        Tensor _calculateProbs(const Tensor &energies, const Tensor &masses, const Tensor &PMNS) const;
        ^
        [[nodiscard]] 
  • nuTens/propagator/propagator.hpp:98:12: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        Tensor _calculateProbs(const Tensor &energies, const Tensor &masses, const Tensor &PMNS) const;
        ~~~~~~ ^
        auto                                                                                           -> Tensor
  • nuTens/propagator/propagator.hpp:100:3: warning: [readability-redundant-access-specifiers]

    redundant access specifier has the same accessibility as the previous access specifier

      private:
      ^~~~~~~~
    /home/runner/work/nuTens/nuTens/nuTens/propagator/propagator.hpp:95:3: note: previously declared here
      private:
      ^
  • nuTens/propagator/propagator.hpp:101:12: warning: [bugprone-reserved-identifier]

    declaration uses identifier '_PMNSmatrix', which is a reserved identifier

        Tensor _PMNSmatrix;
               ^~~~~~~~~~~
               PMNSmatrix
  • nuTens/propagator/const-density-solver.hpp:65:13: warning: [modernize-use-auto]

    use auto when initializing with a template cast to avoid duplicating the type name

                float m_i = masses.getValue<float>({0, i});
                ^~~~~
                auto
    /home/runner/work/nuTens/nuTens/nuTens/propagator/const-density-solver.hpp:66:48: warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
                diagMassMatrix.setValue({0, i, i}, m_i * m_i / 2.0);
                                                   ^
    /home/runner/work/nuTens/nuTens/nuTens/propagator/const-density-solver.hpp:66:60: warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
                diagMassMatrix.setValue({0, i, i}, m_i * m_i / 2.0);
                                                               ^
    /home/runner/work/nuTens/nuTens/nuTens/propagator/const-density-solver.hpp:79:10: warning: annotate this function with 'override' or (rarely) 'final' [cppcoreguidelines-explicit-virtual-functions,modernize-use-override]
        void calculateEigenvalues(const Tensor &energies, Tensor &eigenvectors, Tensor &eigenvalues);
             ^
                                                                                                     override
  • tests/two-flavour-const-matter.cpp:7:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

    int main()
    ~~~ ^
    auto       -> int
  • tests/two-flavour-const-matter.cpp:9:5: warning: [readability-isolate-declaration]

    multiple declarations in a single statement reduces readability

        float m1 = 1.0, m2 = 2.0;
        ^~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:9:26: warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        float m1 = 1.0, m2 = 2.0;
                             ^
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:11:21: warning: 2.6 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        float density = 2.6;
                        ^
  • tests/two-flavour-const-matter.cpp:31:5: warning: [cppcoreguidelines-pro-type-member-init]

    uninitialized record type: 'bargerProp'

        TwoFlavourBarger bargerProp;
        ^
                                   {}
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:35:26: warning: 20 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        for (int i = 0; i <= 20; i++)
                             ^
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:37:23: warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
            float theta = (-1.0 + 2.0 * (float)i / 20.0) * 0.49 * M_PI;
                          ^
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:37:31: warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            float theta = (-1.0 + 2.0 * (float)i / 20.0) * 0.49 * M_PI;
                                  ^
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:37:48: warning: 20.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            float theta = (-1.0 + 2.0 * (float)i / 20.0) * 0.49 * M_PI;
                                                   ^
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:37:56: warning: 0.49 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            float theta = (-1.0 + 2.0 * (float)i / 20.0) * 0.49 * M_PI;
                                                           ^
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:39:59: warning: 999.9 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            bargerProp.setParams(m1, m2, theta, /*baseline=*/-999.9, density);
                                                              ^
  • tests/two-flavour-const-matter.cpp:53:9: warning: [readability-isolate-declaration]

    multiple declarations in a single statement reduces readability

            Tensor eigenVals, eigenVecs;
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • tests/two-flavour-const-matter.cpp:62:9: warning: [modernize-use-auto]

    use auto when initializing with a template cast to avoid duplicating the type name

            float calcV1 = eigenVals.getValue<float>({0, 0});
            ^~~~~
            auto
  • tests/two-flavour-const-matter.cpp:63:9: warning: [modernize-use-auto]

    use auto when initializing with a template cast to avoid duplicating the type name

            float calcV2 = eigenVals.getValue<float>({0, 1});
            ^~~~~
            auto
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:64:24: warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
            float effDm2 = (calcV1 - calcV2) * 2.0 * energy;
                           ^
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:64:44: warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
            float effDm2 = (calcV1 - calcV2) * 2.0 * energy;
                                               ^
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:67:23: warning: 0.00001 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
                          0.00001)
                          ^
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:75:59: warning: 0.00001 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
                          "PMNS[0,0] for theta == " << theta, 0.00001)
                                                              ^
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:78:59: warning: 0.00001 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
                          "PMNS[1,1] for theta == " << theta, 0.00001)
                                                              ^
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:81:59: warning: 0.00001 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
                          "PMNS[0,1] for theta == " << theta, 0.00001)
                                                              ^
    /home/runner/work/nuTens/nuTens/tests/two-flavour-const-matter.cpp:84:59: warning: 0.00001 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
                          "PMNS[1,0] for theta == " << theta, 0.00001)
                                                              ^
  • tests/barger.cpp:9:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

    int main()
    ~~~ ^
    auto       -> int
    /home/runner/work/nuTens/nuTens/tests/barger.cpp:11:22: warning: 500.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        float baseline = 500.0;
                         ^
  • tests/tensor-basic.cpp:10:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

    int main()
    ~~~ ^
    auto       -> int
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:20:34: warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorFloat.setValue({0, 2}, 2.0);
                                     ^
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:22:34: warning: 3.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorFloat.setValue({1, 0}, 3.0);
                                     ^
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:23:34: warning: 4.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorFloat.setValue({1, 1}, 4.0);
                                     ^
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:24:34: warning: 5.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorFloat.setValue({1, 2}, 5.0);
                                     ^
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:26:34: warning: 6.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorFloat.setValue({2, 0}, 6.0);
                                     ^
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:27:34: warning: 7.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorFloat.setValue({2, 1}, 7.0);
                                     ^
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:28:34: warning: 8.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorFloat.setValue({2, 2}, 8.0);
                                     ^
  • tests/tensor-basic.cpp:42:56: warning: [readability-uppercase-literal-suffix]

    floating point literal has suffix 'j', which is not uppercase

        tensorComplex.setValue({0, 0}, std::complex<float>(0.0j));
                                                           ^  ~
                                                              J
  • tests/tensor-basic.cpp:43:56: warning: [readability-uppercase-literal-suffix]

    floating point literal has suffix 'j', which is not uppercase

        tensorComplex.setValue({0, 1}, std::complex<float>(1.0j));
                                                           ^  ~
                                                              J
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:44:56: warning: 2.0j is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorComplex.setValue({0, 2}, std::complex<float>(2.0j));
                                                           ^
  • tests/tensor-basic.cpp:44:56: warning: [readability-uppercase-literal-suffix]

    floating point literal has suffix 'j', which is not uppercase

        tensorComplex.setValue({0, 2}, std::complex<float>(2.0j));
                                                           ^  ~
                                                              J
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:46:56: warning: 3.0j is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorComplex.setValue({1, 0}, std::complex<float>(3.0j));
                                                           ^
  • tests/tensor-basic.cpp:46:56: warning: [readability-uppercase-literal-suffix]

    floating point literal has suffix 'j', which is not uppercase

        tensorComplex.setValue({1, 0}, std::complex<float>(3.0j));
                                                           ^  ~
                                                              J
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:47:56: warning: 4.0j is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorComplex.setValue({1, 1}, std::complex<float>(4.0j));
                                                           ^
  • tests/tensor-basic.cpp:47:56: warning: [readability-uppercase-literal-suffix]

    floating point literal has suffix 'j', which is not uppercase

        tensorComplex.setValue({1, 1}, std::complex<float>(4.0j));
                                                           ^  ~
                                                              J
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:48:56: warning: 5.0j is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorComplex.setValue({1, 2}, std::complex<float>(5.0j));
                                                           ^
  • tests/tensor-basic.cpp:48:56: warning: [readability-uppercase-literal-suffix]

    floating point literal has suffix 'j', which is not uppercase

        tensorComplex.setValue({1, 2}, std::complex<float>(5.0j));
                                                           ^  ~
                                                              J
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:50:56: warning: 6.0j is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorComplex.setValue({2, 0}, std::complex<float>(6.0j));
                                                           ^
  • tests/tensor-basic.cpp:50:56: warning: [readability-uppercase-literal-suffix]

    floating point literal has suffix 'j', which is not uppercase

        tensorComplex.setValue({2, 0}, std::complex<float>(6.0j));
                                                           ^  ~
                                                              J
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:51:56: warning: 7.0j is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorComplex.setValue({2, 1}, std::complex<float>(7.0j));
                                                           ^
  • tests/tensor-basic.cpp:51:56: warning: [readability-uppercase-literal-suffix]

    floating point literal has suffix 'j', which is not uppercase

        tensorComplex.setValue({2, 1}, std::complex<float>(7.0j));
                                                           ^  ~
                                                              J
    /home/runner/work/nuTens/nuTens/tests/tensor-basic.cpp:52:56: warning: 8.0j is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
        tensorComplex.setValue({2, 2}, std::complex<float>(8.0j));
                                                           ^
  • tests/tensor-basic.cpp:122:64: warning: [readability-uppercase-literal-suffix]

    floating point literal has suffix 'j', which is not uppercase

        complexGradTest.setValue({0, 0}, std::complex<float>(0.0 + 0.0j));
                                                                   ^  ~
                                                                      J
  • tests/two-flavour-vacuum.cpp:7:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

    int main()
    ~~~ ^
    auto       -> int

Have any feedback or feature suggestions? Share it here.

Please sign in to comment.