diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 10239fedf..8036fba2a 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -5,7 +5,6 @@ on: [push, pull_request] jobs: ci_test_clang_cxx20: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v1 - name: install_clang @@ -20,7 +19,6 @@ jobs: ci_clang_analyze: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v1 - name: install_ninja @@ -42,7 +40,6 @@ jobs: ci_test_clang: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v1 - name: install_ninja @@ -81,3 +78,22 @@ jobs: run: cmake -S . -B build -DJSON_CI=On - name: build run: cmake --build build --target ci_test_valgrind + + ci_cppcheck: + runs-on: ubuntu-latest + container: nlohmann/json-ci:latest + steps: + - uses: actions/checkout@v2 + - name: cmake + run: cmake -S . -B build -DJSON_CI=On + - name: build + run: cmake --build build --target ci_cppcheck + + ci_cpplint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: cmake + run: cmake -S . -B build -DJSON_CI=On + - name: build + run: cmake --build build --target ci_cpplint diff --git a/Makefile b/Makefile index d3963f503..655bb6c4a 100644 --- a/Makefile +++ b/Makefile @@ -641,4 +641,6 @@ update_hedley: curl https://raw.githubusercontent.com/nemequ/hedley/master/hedley.h -o include/nlohmann/thirdparty/hedley/hedley.hpp $(SED) -i 's/HEDLEY_/JSON_HEDLEY_/g' include/nlohmann/thirdparty/hedley/hedley.hpp grep "[[:blank:]]*#[[:blank:]]*undef" include/nlohmann/thirdparty/hedley/hedley.hpp | grep -v "__" | sort | uniq | $(SED) 's/ //g' | $(SED) 's/undef/undef /g' > include/nlohmann/thirdparty/hedley/hedley_undef.hpp + $(SED) -i '1s/^/#pragma once\n\n/' include/nlohmann/thirdparty/hedley/hedley.hpp + $(SED) -i '1s/^/#pragma once\n\n/' include/nlohmann/thirdparty/hedley/hedley_undef.hpp $(MAKE) amalgamate diff --git a/cmake/ci.cmake b/cmake/ci.cmake index 0134328a5..bf276da99 100644 --- a/cmake/ci.cmake +++ b/cmake/ci.cmake @@ -463,7 +463,7 @@ add_custom_target(ci_cppcheck ############################################################################### add_custom_target(ci_cpplint - COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/third_party/cpplint/cpplint.py --filter=-whitespace,-legal,-runtime/references,-runtime/explicit --quiet --recursive ${SRC_FILES} + COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/third_party/cpplint/cpplint.py --filter=-whitespace,-legal,-runtime/references,-runtime/explicit,-runtime/indentation_namespace,-readability/casting --quiet --recursive ${SRC_FILES} COMMENT "Check code with cpplint" ) diff --git a/include/nlohmann/detail/json_pointer.hpp b/include/nlohmann/detail/json_pointer.hpp index 8c6bda140..4209e676a 100644 --- a/include/nlohmann/detail/json_pointer.hpp +++ b/include/nlohmann/detail/json_pointer.hpp @@ -349,7 +349,7 @@ class json_pointer } std::size_t processed_chars = 0; - unsigned long long res = 0; + unsigned long long res = 0; // NOLINT(runtime/int) JSON_TRY { res = std::stoull(s, &processed_chars); @@ -367,7 +367,7 @@ class json_pointer // only triggered on special platforms (like 32bit), see also // https://github.com/nlohmann/json/pull/2203 - if (res >= static_cast((std::numeric_limits::max)())) + if (res >= static_cast((std::numeric_limits::max)())) // NOLINT(runtime/int) { JSON_THROW(detail::out_of_range::create(410, "array index " + s + " exceeds size_type")); // LCOV_EXCL_LINE } diff --git a/include/nlohmann/thirdparty/hedley/hedley.hpp b/include/nlohmann/thirdparty/hedley/hedley.hpp index c1fa16dbb..9bc7630a6 100644 --- a/include/nlohmann/thirdparty/hedley/hedley.hpp +++ b/include/nlohmann/thirdparty/hedley/hedley.hpp @@ -1,3 +1,5 @@ +#pragma once + /* Hedley - https://nemequ.github.io/hedley * Created by Evan Nemerson * diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index a2507ff63..ff669b424 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -107,6 +107,8 @@ struct position_t #include // pair // #include + + /* Hedley - https://nemequ.github.io/hedley * Created by Evan Nemerson * @@ -12003,7 +12005,7 @@ class json_pointer } std::size_t processed_chars = 0; - unsigned long long res = 0; + unsigned long long res = 0; // NOLINT(runtime/int) JSON_TRY { res = std::stoull(s, &processed_chars); @@ -12021,7 +12023,7 @@ class json_pointer // only triggered on special platforms (like 32bit), see also // https://github.com/nlohmann/json/pull/2203 - if (res >= static_cast((std::numeric_limits::max)())) + if (res >= static_cast((std::numeric_limits::max)())) // NOLINT(runtime/int) { JSON_THROW(detail::out_of_range::create(410, "array index " + s + " exceeds size_type")); // LCOV_EXCL_LINE }