From 21a193c69ba3082927d6570514d750803fd30fe5 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 31 Jan 2021 15:50:25 +0100 Subject: [PATCH] :construction_worker: add CI step for coverage --- .github/workflows/ubuntu.yml | 2 +- test/src/unit-constructor1.cpp | 14 +++++++------- test/src/unit-regression1.cpp | 2 +- test/src/unit-udt.cpp | 2 +- test/thirdparty/fifo_map/fifo_map.hpp | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 3e86b4219..20889fec9 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -130,7 +130,7 @@ jobs: - name: build run: cmake --build build --target ci_test_coverage - name: copy - run: cp -r html /workdir ; cp -r json.info /workdir + run: cp -r build/build_coverage/html /workdir ; cp -r build/build_coverage/json.info /workdir - name: archive coverage report uses: actions/upload-artifact@v2 with: diff --git a/test/src/unit-constructor1.cpp b/test/src/unit-constructor1.cpp index ba9bf12b7..0ba21e25a 100644 --- a/test/src/unit-constructor1.cpp +++ b/test/src/unit-constructor1.cpp @@ -1119,7 +1119,7 @@ TEST_CASE("constructors") { // This should break through any short string optimization in std::string std::string source(1024, '!'); - const char* source_addr = source.data(); + const char* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer) json j = {std::move(source)}; CHECK(j[0].get_ref().data() == source_addr); } @@ -1128,7 +1128,7 @@ TEST_CASE("constructors") { // This should break through any short string optimization in std::string std::string source(1024, '!'); - const char* source_addr = source.data(); + const char* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer) json j = {{"key", std::move(source)}}; CHECK(j["key"].get_ref().data() == source_addr); } @@ -1137,7 +1137,7 @@ TEST_CASE("constructors") { // This should break through any short string optimization in std::string std::string source(1024, '!'); - const char* source_addr = source.data(); + const char* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer) json j = {{std::move(source), 42}}; CHECK(j.get_ref().begin()->first.data() == source_addr); } @@ -1148,7 +1148,7 @@ TEST_CASE("constructors") SECTION("constructor with implicit types (array)") { json::array_t source = {1, 2, 3}; - const json* source_addr = source.data(); + const json* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer) json j {std::move(source)}; CHECK(j[0].get_ref().data() == source_addr); } @@ -1156,7 +1156,7 @@ TEST_CASE("constructors") SECTION("constructor with implicit types (object)") { json::array_t source = {1, 2, 3}; - const json* source_addr = source.data(); + const json* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer) json j {{"key", std::move(source)}}; CHECK(j["key"].get_ref().data() == source_addr); } @@ -1164,7 +1164,7 @@ TEST_CASE("constructors") SECTION("assignment with implicit types (array)") { json::array_t source = {1, 2, 3}; - const json* source_addr = source.data(); + const json* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer) json j = {std::move(source)}; CHECK(j[0].get_ref().data() == source_addr); } @@ -1172,7 +1172,7 @@ TEST_CASE("constructors") SECTION("assignment with implicit types (object)") { json::array_t source = {1, 2, 3}; - const json* source_addr = source.data(); + const json* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer) json j = {{"key", std::move(source)}}; CHECK(j["key"].get_ref().data() == source_addr); } diff --git a/test/src/unit-regression1.cpp b/test/src/unit-regression1.cpp index 449d9fd91..45dc7a333 100644 --- a/test/src/unit-regression1.cpp +++ b/test/src/unit-regression1.cpp @@ -94,7 +94,7 @@ template struct foo_serializer < T, typename std::enable_if < !std::is_same::value >::type > { template - static void to_json(BasicJsonType& j, const T& value) noexcept + static void to_json(BasicJsonType& j, const T& value) noexcept // NOLINT(bugprone-exception-escape) { ::nlohmann::to_json(j, value); } diff --git a/test/src/unit-udt.cpp b/test/src/unit-udt.cpp index 0983b371f..2bebd8f59 100644 --- a/test/src/unit-udt.cpp +++ b/test/src/unit-udt.cpp @@ -407,7 +407,7 @@ TEST_CASE("adl_serializer specialization" * doctest::test_suite("udt")) json j = optPerson; CHECK(j.is_null()); - optPerson.reset(new udt::person{{42}, {"John Doe"}, udt::country::russia}); // NOLINT(cppcoreguidelines-owning-memory) + optPerson.reset(new udt::person{{42}, {"John Doe"}, udt::country::russia}); // NOLINT(cppcoreguidelines-owning-memory,modernize-make-shared) j = optPerson; CHECK_FALSE(j.is_null()); diff --git a/test/thirdparty/fifo_map/fifo_map.hpp b/test/thirdparty/fifo_map/fifo_map.hpp index c281e3be3..cfa38c97b 100644 --- a/test/thirdparty/fifo_map/fifo_map.hpp +++ b/test/thirdparty/fifo_map/fifo_map.hpp @@ -99,7 +99,7 @@ template < class T, class Compare = fifo_map_compare, class Allocator = std::allocator> - > class fifo_map + > class fifo_map // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions,-warnings-as-errors) { public: using key_type = Key; @@ -514,10 +514,10 @@ template < internal_map_type m_map; }; -} +} // namespace nlohmann // specialization of std::swap -namespace std +namespace std // NOLINT(cert-dcl58-cpp,-warnings-as-errors) { template inline void swap(nlohmann::fifo_map& m1, @@ -525,6 +525,6 @@ inline void swap(nlohmann::fifo_map& m1, { m1.swap(m2); } -} +} // namespace std #endif