Refactor configuration for StaticAnalysis

Upstream StaticAnalysis looks to be changing for more flexibility with
source files to process.  While these changes may eventually benefit
argparse, the public interfaces are in flux and we need a stable tool.
argparse also needs a SA change which is not yet upstream.

Trying to run clang-tidy via StaticAnalysis on a single file in a
directory with many source file is not easy, so move the analysis kernel
to a location (i.e. tools) where it is the only C++ source file.

Another benefit is cppcheck no longer needs to be told to ignore the test
sources.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
This commit is contained in:
Sean Robinson 2022-02-07 11:51:22 -07:00
parent 79df7808d2
commit 97204363b5
5 changed files with 13 additions and 12 deletions

View File

@ -28,15 +28,13 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Analyze - name: Analyze
uses: JacobDomagala/StaticAnalysis@master uses: skrobinson/StaticAnalysis@stable-for-argparse
with: with:
clang_tidy_args: >- clang_tidy_args: >-
--config-file=$GITHUB_WORKSPACE/.clang-tidy --config-file=$GITHUB_WORKSPACE/.clang-tidy
--extra-arg=-I$GITHUB_WORKSPACE/include --extra-arg=-std=c++17 --extra-arg=-I$GITHUB_WORKSPACE/include --extra-arg=-std=c++17
cppcheck_args: >- cppcheck_args: >-
--enable=all --inconclusive --inline-suppr --enable=all --inconclusive --inline-suppr
-i$GITHUB_WORKSPACE/test/main.cpp
-i$GITHUB_WORKSPACE/test/test_*.cpp
--suppress=missingInclude --suppress=missingInclude
--suppress='*:$GITHUB_WORKSPACE/test/doctest.hpp' --suppress='*:$GITHUB_WORKSPACE/test/doctest.hpp'
init_script: tools/static_analysis_setup.sh init_script: tools/static_analysis_setup.sh

View File

@ -57,10 +57,3 @@ set_property(TARGET ARGPARSE PROPERTY CXX_STANDARD 17)
# Set ${PROJECT_NAME} as the startup project # Set ${PROJECT_NAME} as the startup project
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ARGPARSE) set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ARGPARSE)
file(GLOB ARGPARSE_LINT_SOURCES
tidy-base.cpp
)
ADD_EXECUTABLE(ARGPARSE_LINT ${ARGPARSE_LINT_SOURCES})
set_target_properties(ARGPARSE_LINT PROPERTIES OUTPUT_NAME tidy-base)
set_property(TARGET ARGPARSE_LINT PROPERTY CXX_STANDARD 17)

10
tools/CMakeLists.txt Normal file
View File

@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.12)
project(argparse)
file(GLOB ARGPARSE_LINT_SOURCES
tidy-base.cpp
)
ADD_EXECUTABLE(ARGPARSE_LINT ${ARGPARSE_LINT_SOURCES})
set_target_properties(ARGPARSE_LINT PROPERTIES OUTPUT_NAME tidy-base)
set_property(TARGET ARGPARSE_LINT PROPERTY CXX_STANDARD 17)
INCLUDE_DIRECTORIES("../include" ".")

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
# Change to the "test" subdir before "build" subdir is made. # Change to the "tools" subdir before "build" subdir is made.
cd test cd tools