1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-30 12:43:52 +00:00

fix: some GCC warnings and update codecov (#813)

* add some warning for GCC output

* fix some warnings

* style: pre-commit.ci fixes

* update ubuntu image used for cmake tests so it doesn't auto transition to 22.04

* try a few more warning flags

* install the correct files

* style: pre-commit.ci fixes

* fix install files

* add a few more things to pre-commit

* try a fix for codacy

* another try at codecov

* more coverage tweaks

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Philip Top 2022-12-10 07:30:36 -08:00 committed by GitHub
parent 71755e4f67
commit 75b19db1d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 25 deletions

View File

@ -1,3 +1,6 @@
ignore: ignore:
- "tests" - "tests"
- "examples" - "examples"
- "book"
- "docs"
- "test_package"

View File

@ -13,7 +13,7 @@ runs:
using: composite using: composite
steps: steps:
- name: CMake ${{ inputs.cmake-version }} - name: CMake ${{ inputs.cmake-version }}
uses: jwlawson/actions-setup-cmake@v1.12 uses: jwlawson/actions-setup-cmake@v1.13
with: with:
cmake-version: "${{ inputs.cmake-version }}" cmake-version: "${{ inputs.cmake-version }}"
- run: | - run: |

View File

@ -48,14 +48,15 @@ jobs:
- name: Prepare coverage - name: Prepare coverage
run: | run: |
lcov --directory . --capture --output-file coverage.info lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' --output-file coverage.info lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' '*/book/*' --output-file coverage.info
lcov --list coverage.info lcov --list coverage.info
working-directory: build working-directory: build
- uses: codecov/codecov-action@v3 - uses: codecov/codecov-action@v3
with: with:
files: build/coverage.info
fail_ci_if_error: true fail_ci_if_error: true
working-directory: build functionalities: fixes
clang-tidy: clang-tidy:
name: Clang-Tidy name: Clang-Tidy
@ -129,7 +130,7 @@ jobs:
cmake-config: cmake-config:
name: CMake config check name: CMake config check
runs-on: ubuntu-latest runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3

View File

@ -16,9 +16,13 @@ repos:
- id: check-merge-conflict - id: check-merge-conflict
- id: check-symlinks - id: check-symlinks
- id: check-yaml - id: check-yaml
- id: check-toml
- id: end-of-file-fixer - id: end-of-file-fixer
- id: mixed-line-ending - id: mixed-line-ending
- id: trailing-whitespace - id: trailing-whitespace
- id: check-shebang-scripts-are-executable
- id: check-executables-have-shebangs
- id: debug-statements
- repo: https://github.com/pre-commit/mirrors-clang-format - repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.4 rev: v15.0.4

View File

@ -110,13 +110,14 @@ jobs:
gcc11: gcc11:
containerImage: gcc:11 containerImage: gcc:11
cli11.std: 20 cli11.std: 20
gcc8: cli11.options: -DCMAKE_CXX_FLAGS="-Wredundant-decls -Wconversion"
containerImage: gcc:8 gcc7:
cli11.std: 17 containerImage: gcc:7
cli11.std: 14
cli11.options: -DCMAKE_CXX_FLAGS="-Wconversion"
gcc4.8: gcc4.8:
containerImage: helics/buildenv:gcc4-8-builder containerImage: helics/buildenv:gcc4-8-builder
cli11.std: 11 cli11.std: 11
cli11.options:
clang3.4: clang3.4:
containerImage: silkeh/clang:3.4 containerImage: silkeh/clang:3.4
cli11.std: 11 cli11.std: 11

View File

@ -49,8 +49,11 @@ struct AppFriend;
} // namespace detail } // namespace detail
namespace FailureMessage { namespace FailureMessage {
std::string simple(const App *app, const Error &e); /// Printout a clean, simple message on error (the default in CLI11 1.5+)
std::string help(const App *app, const Error &e); CLI11_INLINE std::string simple(const App *app, const Error &e);
/// Printout the full help string on error (if this fn is set, the old default for CLI11)
CLI11_INLINE std::string help(const App *app, const Error &e);
} // namespace FailureMessage } // namespace FailureMessage
/// enumeration of modes of how to deal with extras in config files /// enumeration of modes of how to deal with extras in config files
@ -1352,16 +1355,6 @@ CLI11_INLINE void retire_option(App *app, const std::string &option_name);
/// Helper function to mark an option as retired /// Helper function to mark an option as retired
CLI11_INLINE void retire_option(App &app, const std::string &option_name); CLI11_INLINE void retire_option(App &app, const std::string &option_name);
namespace FailureMessage {
/// Printout a clean, simple message on error (the default in CLI11 1.5+)
CLI11_INLINE std::string simple(const App *app, const Error &e);
/// Printout the full help string on error (if this fn is set, the old default for CLI11)
CLI11_INLINE std::string help(const App *app, const Error &e);
} // namespace FailureMessage
namespace detail { namespace detail {
/// This class is simply to allow tests access to App's protected functions /// This class is simply to allow tests access to App's protected functions
struct AppFriend { struct AppFriend {

View File

@ -2,7 +2,6 @@ set(CLI11_headerLoc "${PROJECT_SOURCE_DIR}/include/CLI")
set(CLI11_headers set(CLI11_headers
${CLI11_headerLoc}/App.hpp ${CLI11_headerLoc}/App.hpp
${CLI11_headerLoc}/CLI.hpp
${CLI11_headerLoc}/Config.hpp ${CLI11_headerLoc}/Config.hpp
${CLI11_headerLoc}/ConfigFwd.hpp ${CLI11_headerLoc}/ConfigFwd.hpp
${CLI11_headerLoc}/Error.hpp ${CLI11_headerLoc}/Error.hpp
@ -12,7 +11,6 @@ set(CLI11_headers
${CLI11_headerLoc}/Option.hpp ${CLI11_headerLoc}/Option.hpp
${CLI11_headerLoc}/Split.hpp ${CLI11_headerLoc}/Split.hpp
${CLI11_headerLoc}/StringTools.hpp ${CLI11_headerLoc}/StringTools.hpp
${CLI11_headerLoc}/Timer.hpp
${CLI11_headerLoc}/TypeTools.hpp ${CLI11_headerLoc}/TypeTools.hpp
${CLI11_headerLoc}/Validators.hpp ${CLI11_headerLoc}/Validators.hpp
${CLI11_headerLoc}/Version.hpp) ${CLI11_headerLoc}/Version.hpp)
@ -28,10 +26,13 @@ set(CLI11_impl_headers
${CLI11_implLoc}/StringTools_inl.hpp ${CLI11_implLoc}/StringTools_inl.hpp
${CLI11_implLoc}/Validators_inl.hpp) ${CLI11_implLoc}/Validators_inl.hpp)
set(CLI11_library_headers ${CLI11_headerLoc}/CLI.hpp ${CLI11_headerLoc}/Timer.hpp)
if(CLI11_PRECOMPILED) if(CLI11_PRECOMPILED)
# Create static lib # Create static lib
file(GLOB CLI11_precompile_sources "${PROJECT_SOURCE_DIR}/src/*.cpp") file(GLOB CLI11_precompile_sources "${PROJECT_SOURCE_DIR}/src/*.cpp")
add_library(CLI11 STATIC ${CLI11_headers} ${CLI11_impl_headers} ${CLI11_precompile_sources}) add_library(CLI11 STATIC ${CLI11_headers} ${CLI11_library_headers} ${CLI11_impl_headers}
${CLI11_precompile_sources})
target_compile_definitions(CLI11 PUBLIC -DCLI11_COMPILE) target_compile_definitions(CLI11 PUBLIC -DCLI11_COMPILE)
set(PUBLIC_OR_INTERFACE PUBLIC) set(PUBLIC_OR_INTERFACE PUBLIC)
@ -39,7 +40,7 @@ else()
add_library(CLI11 INTERFACE) add_library(CLI11 INTERFACE)
if(CMAKE_VERSION VERSION_GREATER 3.19) if(CMAKE_VERSION VERSION_GREATER 3.19)
# This is only useful for visual studio and other IDE builds # This is only useful for visual studio and other IDE builds
target_sources(CLI11 PRIVATE ${CLI11_headers} ${CLI11_impl_headers}) target_sources(CLI11 PRIVATE ${CLI11_headers} ${CLI11_library_headers} ${CLI11_impl_headers})
endif() endif()
set(PUBLIC_OR_INTERFACE INTERFACE) set(PUBLIC_OR_INTERFACE INTERFACE)
@ -112,7 +113,8 @@ if(CLI11_INSTALL)
# Make an export target # Make an export target
install(TARGETS CLI11 EXPORT CLI11Targets) install(TARGETS CLI11 EXPORT CLI11Targets)
if(NOT CLI11_SINGLE_FILE) if(NOT CLI11_SINGLE_FILE)
install(FILES ${CLI11_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI") install(FILES ${CLI11_headers} ${CLI11_library_headers}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI")
if(NOT CLI11_COMPILE) if(NOT CLI11_COMPILE)
install(FILES ${CLI11_impl_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI/impl") install(FILES ${CLI11_impl_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI/impl")
endif() endif()