👷 add CI steps for cppcheck and cpplint
This commit is contained in:
parent
2e044e27a2
commit
0a27d1cf59
22
.github/workflows/ubuntu.yml
vendored
22
.github/workflows/ubuntu.yml
vendored
@ -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
|
||||
|
||||
2
Makefile
2
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
|
||||
|
||||
@ -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"
|
||||
)
|
||||
|
||||
|
||||
@ -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<unsigned long long>((std::numeric_limits<size_type>::max)()))
|
||||
if (res >= static_cast<unsigned long long>((std::numeric_limits<size_type>::max)())) // NOLINT(runtime/int)
|
||||
{
|
||||
JSON_THROW(detail::out_of_range::create(410, "array index " + s + " exceeds size_type")); // LCOV_EXCL_LINE
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
/* Hedley - https://nemequ.github.io/hedley
|
||||
* Created by Evan Nemerson <evan@nemerson.com>
|
||||
*
|
||||
|
||||
@ -107,6 +107,8 @@ struct position_t
|
||||
|
||||
#include <utility> // pair
|
||||
// #include <nlohmann/thirdparty/hedley/hedley.hpp>
|
||||
|
||||
|
||||
/* Hedley - https://nemequ.github.io/hedley
|
||||
* Created by Evan Nemerson <evan@nemerson.com>
|
||||
*
|
||||
@ -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<unsigned long long>((std::numeric_limits<size_type>::max)()))
|
||||
if (res >= static_cast<unsigned long long>((std::numeric_limits<size_type>::max)())) // NOLINT(runtime/int)
|
||||
{
|
||||
JSON_THROW(detail::out_of_range::create(410, "array index " + s + " exceeds size_type")); // LCOV_EXCL_LINE
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user