Skip to content

Commit

Permalink
Require clang-formated code
Browse files Browse the repository at this point in the history
Add clang-format check to the circleci steps

Closes #59
  • Loading branch information
rfernandes authored and markaylett committed Nov 10, 2019
1 parent c294b74 commit 40784cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- checkout
- run:
name: Run Cppcheck
name: Run Cppcheck / ClangFormat
command: |
mkdir -p build
cd build
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions toolbox/ipc/MpmcQueue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,19 +226,19 @@ class MpmcQueue {
bool pop(ValueT& val) noexcept
{
static_assert(std::is_nothrow_move_assignable_v<ValueT>);
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<ValueT>);
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<ValueT>);
return write([&val](ValueT & ref) noexcept { ref = std::move(val); });
return write([&val](ValueT& ref) noexcept { ref = std::move(val); });
}

private:
Expand Down
2 changes: 1 addition & 1 deletion toolbox/util/Traits.ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<decltype(fn)>;
using Tuple = Traits::Pack<tuple>;
Expand Down

0 comments on commit 40784cc

Please sign in to comment.