Commit ab94ee7e81020d30a20d8663912bce9b55c5409b

Authored by Henry Schreiner
Committed by Henry Schreiner
1 parent 59052a6b

clang-tidy correctly run by CI

.github/CONTRIBUTING.md
... ... @@ -17,7 +17,7 @@ In general, make sure the addition is well thought out and does not increase the
17 17 * Once you make the PR, tests will run to make sure your code works on all supported platforms
18 18 * The test coverage is also measured, and that should remain 100%
19 19 * 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.
20   -* Everything must pass clang-tidy as well, run with `-DCLANG_TIDY_FIX-ON` (make sure you use a single threaded build process!)
  20 +* 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).
21 21  
22 22  
23 23 ## Pre-commit
... ...
CMakeLists.txt
... ... @@ -75,21 +75,19 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
75 75 endif()
76 76 endif()
77 77  
78   - if(NOT CMAKE_VERSION VERSION_LESS 3.6 AND CLANG_TIDY)
79   - # Add clang-tidy if available
80   - option(CLANG_TIDY_FIX "Perform fixes for Clang-Tidy" OFF)
81   - find_program(
82   - CLANG_TIDY_EXE
83   - NAMES "clang-tidy"
84   - DOC "Path to clang-tidy executable"
85   - )
86   -
87   - if(CLANG_TIDY_EXE)
88   - if(CLANG_TIDY_FIX)
89   - set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-fix")
90   - else()
91   - set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}")
92   - endif()
  78 + if(NOT CMAKE_VERSION VERSION_LESS 3.6)
  79 + option(CLI11_CLANG_TIDY "Look for and use Clang-Tidy")
  80 + set(CLI11_CLANG_TIDY_OPTIONS "" CACHE STRING "Clang tidy option, such as -fix")
  81 + if(CLI11_CLANG_TIDY)
  82 +
  83 + find_program(
  84 + CLANG_TIDY_EXE
  85 + NAMES "clang-tidy"
  86 + DOC "Path to clang-tidy executable"
  87 + REQUIRED
  88 + )
  89 +
  90 + set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" ${CLI11_CLANG_TIDY_OPTIONS})
93 91 endif()
94 92 endif()
95 93  
... ...
azure-pipelines.yml
... ... @@ -18,13 +18,13 @@ jobs:
18 18 - job: ClangTidy
19 19 variables:
20 20 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"
21   - cli11.options: -DCLANG_TIDY_FIX=ON
  21 + cli11.options: -DCLI11_CLANG_TIDY=ON -DCLI11_CLANG_TIDY_OPTIONS="-fix"
22 22 cli11.std: 11
23 23 cli11.single: OFF
24 24 CMAKE_BUILD_PARALLEL_LEVEL: 1
25 25 pool:
26   - vmImage: 'ubuntu-16.04'
27   - container: silkeh/clang:5
  26 + vmImage: 'ubuntu-latest'
  27 + container: silkeh/clang:8
28 28 steps:
29 29 - template: .ci/azure-cmake.yml
30 30 - template: .ci/azure-build.yml
... ...
book/README.md
... ... @@ -53,8 +53,6 @@ Reading/producing `.ini` files for configuration is also supported, as is using
53 53  
54 54 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.
55 55  
56   -This guide was based on CLI11 1.7.
57   -
58 56 [GooFit]: https://github.com/GooFit/GooFit
59 57 [DIANA/HEP]: http://diana-hep.org
60 58 [CLI11]: https://github.com/CLIUtils/CLI11
... ...
book/chapters/installation.md
... ... @@ -86,6 +86,7 @@ For the curious, the CMake options and defaults are listed below. Most options d
86 86 | `CLI11_SINGLE_FILE_TESTS=OFF` | Run the tests on the generated single file version as well |
87 87 | `CLI11_EXAMPLES=ON` | Build the example programs. |
88 88 | `CLI11_TESTING=ON` | Build the tests. |
89   -| `CLANG_TIDY_FIX=OFF` | Run `clang-tidy` on the examples and headers and apply fixes. (Changes source code!) Requires LLVM and CMake 3.6+. |
  89 +| `CLI11_CLANG_TIDY=OFF` | Run `clang-tidy` on the examples and headers. Requires CMake 3.6+. |
  90 +| `CLI11_CLANG_TIDY_OPTIONS=""` | Options to pass to `clang-tidy`, such as `-fix` (single threaded build only if applying fixes!) |
90 91  
91 92 [^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.
... ...