mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-07 15:33:51 +00:00
clang-tidy correctly run by CI
This commit is contained in:
parent
59052a6b27
commit
ab94ee7e81
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@ -17,7 +17,7 @@ In general, make sure the addition is well thought out and does not increase the
|
||||
* Once you make the PR, tests will run to make sure your code works on all supported platforms
|
||||
* The test coverage is also measured, and that should remain 100%
|
||||
* Formatting should be done with pre-commit, otherwise the format check will not pass. However, it is trivial to apply this to your PR, so don't worry about this check. If you do want to run it, see below.
|
||||
* Everything must pass clang-tidy as well, run with `-DCLANG_TIDY_FIX-ON` (make sure you use a single threaded build process!)
|
||||
* Everything must pass clang-tidy as well, run with `-DCLI11_CLANG_TIDY=ON` (if you set `-DCLI11_CLANG_TIDY_OPTIONS="-fix"`, make sure you use a single threaded build process, or just build one example target).
|
||||
|
||||
|
||||
## Pre-commit
|
||||
|
@ -75,21 +75,19 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.6 AND CLANG_TIDY)
|
||||
# Add clang-tidy if available
|
||||
option(CLANG_TIDY_FIX "Perform fixes for Clang-Tidy" OFF)
|
||||
find_program(
|
||||
CLANG_TIDY_EXE
|
||||
NAMES "clang-tidy"
|
||||
DOC "Path to clang-tidy executable"
|
||||
)
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.6)
|
||||
option(CLI11_CLANG_TIDY "Look for and use Clang-Tidy")
|
||||
set(CLI11_CLANG_TIDY_OPTIONS "" CACHE STRING "Clang tidy option, such as -fix")
|
||||
if(CLI11_CLANG_TIDY)
|
||||
|
||||
if(CLANG_TIDY_EXE)
|
||||
if(CLANG_TIDY_FIX)
|
||||
set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-fix")
|
||||
else()
|
||||
set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}")
|
||||
endif()
|
||||
find_program(
|
||||
CLANG_TIDY_EXE
|
||||
NAMES "clang-tidy"
|
||||
DOC "Path to clang-tidy executable"
|
||||
REQUIRED
|
||||
)
|
||||
|
||||
set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" ${CLI11_CLANG_TIDY_OPTIONS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -18,13 +18,13 @@ jobs:
|
||||
- job: ClangTidy
|
||||
variables:
|
||||
CXX_FLAGS: "-Werror -Wcast-align -Wfloat-equal -Wimplicit-atomic-properties -Wmissing-declarations -Woverlength-strings -Wshadow -Wstrict-selector-match -Wundeclared-selector -Wunreachable-code -std=c++11"
|
||||
cli11.options: -DCLANG_TIDY_FIX=ON
|
||||
cli11.options: -DCLI11_CLANG_TIDY=ON -DCLI11_CLANG_TIDY_OPTIONS="-fix"
|
||||
cli11.std: 11
|
||||
cli11.single: OFF
|
||||
CMAKE_BUILD_PARALLEL_LEVEL: 1
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
container: silkeh/clang:5
|
||||
vmImage: 'ubuntu-latest'
|
||||
container: silkeh/clang:8
|
||||
steps:
|
||||
- template: .ci/azure-cmake.yml
|
||||
- template: .ci/azure-build.yml
|
||||
|
@ -53,8 +53,6 @@ Reading/producing `.ini` files for configuration is also supported, as is using
|
||||
|
||||
CLI11 was developed at the [University of Cincinnati] in support of the [GooFit] library under [NSF Award 1414736][NSF 1414736]. It was featured in a [DIANA/HEP] meeting at CERN. Please give it a try! Feedback is always welcome.
|
||||
|
||||
This guide was based on CLI11 1.7.
|
||||
|
||||
[GooFit]: https://github.com/GooFit/GooFit
|
||||
[DIANA/HEP]: http://diana-hep.org
|
||||
[CLI11]: https://github.com/CLIUtils/CLI11
|
||||
|
@ -86,6 +86,7 @@ For the curious, the CMake options and defaults are listed below. Most options d
|
||||
| `CLI11_SINGLE_FILE_TESTS=OFF` | Run the tests on the generated single file version as well |
|
||||
| `CLI11_EXAMPLES=ON` | Build the example programs. |
|
||||
| `CLI11_TESTING=ON` | Build the tests. |
|
||||
| `CLANG_TIDY_FIX=OFF` | Run `clang-tidy` on the examples and headers and apply fixes. (Changes source code!) Requires LLVM and CMake 3.6+. |
|
||||
| `CLI11_CLANG_TIDY=OFF` | Run `clang-tidy` on the examples and headers. Requires CMake 3.6+. |
|
||||
| `CLI11_CLANG_TIDY_OPTIONS=""` | Options to pass to `clang-tidy`, such as `-fix` (single threaded build only if applying fixes!) |
|
||||
|
||||
[^1]: Docker is being used to create a pristine disposable environment; there is nothing special about this container. Alpine is being used because it is small, modern, and fast. Commands are similar on any other platform.
|
||||
|
Loading…
x
Reference in New Issue
Block a user