diff --git a/.circleci/config.yml b/.circleci/config.yml index 311bb90b6..8d78c1ed8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: steps: - checkout - run: - name: Run Cppcheck + name: Run Cppcheck / ClangFormat command: | mkdir -p build cd build @@ -16,6 +16,9 @@ jobs: -DCMAKE_C_COMPILER=gcc-8 \ -DCMAKE_CXX_COMPILER=g++-8 make -j2 cppcheck + make clang-format && + [[ -z "$(git status --porcelain)" ]] || + { echo "Please ensure files are formated by running target clang-format"; exit 1; } test_clang_debug: docker: - image: registry.gitlab.com/reactivemarkets/public-registry/toolchain-cpp:debian diff --git a/toolbox/ipc/MpmcQueue.hpp b/toolbox/ipc/MpmcQueue.hpp index c8d4c7b86..53bb743f6 100644 --- a/toolbox/ipc/MpmcQueue.hpp +++ b/toolbox/ipc/MpmcQueue.hpp @@ -226,19 +226,19 @@ class MpmcQueue { bool pop(ValueT& val) noexcept { static_assert(std::is_nothrow_move_assignable_v); - return read([&val](ValueT && ref) noexcept { val = std::move(ref); }); + return read([&val](ValueT&& ref) noexcept { val = std::move(ref); }); } /// Returns false if capacity is exceeded. bool push(const ValueT& val) noexcept { static_assert(std::is_nothrow_copy_assignable_v); - return write([&val](ValueT & ref) noexcept { ref = val; }); + return write([&val](ValueT& ref) noexcept { ref = val; }); } /// Returns false if capacity is exceeded. bool push(ValueT&& val) noexcept { static_assert(std::is_nothrow_move_assignable_v); - return write([&val](ValueT & ref) noexcept { ref = std::move(val); }); + return write([&val](ValueT& ref) noexcept { ref = std::move(val); }); } private: diff --git a/toolbox/util/Traits.ut.cpp b/toolbox/util/Traits.ut.cpp index 48cf645d5..1d9407f17 100644 --- a/toolbox/util/Traits.ut.cpp +++ b/toolbox/util/Traits.ut.cpp @@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE(TraitsConstLambdaCase) BOOST_AUTO_TEST_CASE(TraitsConstNoexceptLambdaCase) { - const auto fn = [](short, int, long) noexcept->double { return 0.0; }; + const auto fn = [](short, int, long) noexcept -> double { return 0.0; }; using Traits = FunctionTraits; using Tuple = Traits::Pack;