cmake-pre-commit-hooks 1.10.0__tar.gz → 2.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cmake_pre_commit_hooks-2.0.1/.codacy.yml +4 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.github/scripts/release_version.py +10 -3
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.github/workflows/ci.yml +13 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.github/workflows/publish_release.yml +3 -2
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.github/workflows/pull_request.yml +1 -1
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.pre-commit-config.yaml +10 -9
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.pre-commit-hooks.yaml +18 -7
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/AGENTS.md +1 -1
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/CHANGELOG.md +48 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/MANIFEST.in +1 -1
- {cmake_pre_commit_hooks-1.10.0/cmake_pre_commit_hooks.egg-info → cmake_pre_commit_hooks-2.0.1}/PKG-INFO +71 -16
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/README.md +68 -13
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/changelog.d/README.md +1 -0
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/_cli.py +133 -0
- cmake_pre_commit_hooks-1.10.0/cmake_pc_hooks/cpplint.py → cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/_cmake/__init__.py +5 -5
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/_cmake/configure.py +259 -0
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/_cmake/locate.py +138 -0
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/_cmake/options.py +174 -0
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/_cmake/trace.py +65 -0
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/_config.py +127 -0
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/_hook.py +82 -0
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/_runner.py +264 -0
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/clang_format.py +26 -0
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/clang_tidy.py +61 -0
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/cppcheck.py +61 -0
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/cpplint.py +32 -0
- cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/include_what_you_use.py +54 -0
- cmake_pre_commit_hooks-1.10.0/tests/python/cpplint_test.py → cmake_pre_commit_hooks-2.0.1/cmake_pc_hooks/lizard.py +12 -1
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1/cmake_pre_commit_hooks.egg-info}/PKG-INFO +71 -16
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/cmake_pre_commit_hooks.egg-info/SOURCES.txt +17 -6
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/cmake_pre_commit_hooks.egg-info/requires.txt +4 -2
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/cmake_pre_commit_hooks.egg-info/scm_file_list.json +17 -6
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/pyproject.toml +8 -3
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/integration/cmake_options_test.py +32 -7
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/integration/hooks_test.py +1 -1
- cmake_pre_commit_hooks-2.0.1/tests/python/_cli_test.py +192 -0
- cmake_pre_commit_hooks-2.0.1/tests/python/_cmake_configure_test.py +318 -0
- cmake_pre_commit_hooks-2.0.1/tests/python/_cmake_locate_test.py +108 -0
- cmake_pre_commit_hooks-2.0.1/tests/python/_cmake_options_test.py +203 -0
- cmake_pre_commit_hooks-2.0.1/tests/python/_cmake_trace_test.py +77 -0
- cmake_pre_commit_hooks-2.0.1/tests/python/_config_test.py +166 -0
- cmake_pre_commit_hooks-2.0.1/tests/python/_runner_test.py +571 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/python/_test_utils.py +28 -43
- cmake_pre_commit_hooks-2.0.1/tests/python/clang_format_test.py +43 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/python/clang_tidy_test.py +20 -23
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/python/conftest.py +12 -2
- cmake_pre_commit_hooks-2.0.1/tests/python/cppcheck_test.py +57 -0
- cmake_pre_commit_hooks-2.0.1/tests/python/cpplint_test.py +48 -0
- cmake_pre_commit_hooks-2.0.1/tests/python/iwyu_test.py +78 -0
- cmake_pre_commit_hooks-2.0.1/tests/python/lizard_test.py +36 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/python/release_scripts_test.py +18 -0
- cmake_pre_commit_hooks-1.10.0/cmake_pc_hooks/_argparse.py +0 -332
- cmake_pre_commit_hooks-1.10.0/cmake_pc_hooks/_cmake.py +0 -659
- cmake_pre_commit_hooks-1.10.0/cmake_pc_hooks/_utils.py +0 -242
- cmake_pre_commit_hooks-1.10.0/cmake_pc_hooks/clang_format.py +0 -59
- cmake_pre_commit_hooks-1.10.0/cmake_pc_hooks/clang_tidy.py +0 -82
- cmake_pre_commit_hooks-1.10.0/cmake_pc_hooks/cppcheck.py +0 -87
- cmake_pre_commit_hooks-1.10.0/cmake_pc_hooks/include_what_you_use.py +0 -141
- cmake_pre_commit_hooks-1.10.0/cmake_pc_hooks/lizard.py +0 -72
- cmake_pre_commit_hooks-1.10.0/tests/python/_argparse_test.py +0 -390
- cmake_pre_commit_hooks-1.10.0/tests/python/_cmake_test.py +0 -728
- cmake_pre_commit_hooks-1.10.0/tests/python/_utils_test.py +0 -203
- cmake_pre_commit_hooks-1.10.0/tests/python/clang_format_test.py +0 -72
- cmake_pre_commit_hooks-1.10.0/tests/python/cppcheck_test.py +0 -66
- cmake_pre_commit_hooks-1.10.0/tests/python/iwyu_test.py +0 -144
- cmake_pre_commit_hooks-1.10.0/tests/python/lizard_test.py +0 -90
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.codespell.allow +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.editorconfig +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.github/dependabot.yml +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.github/scripts/pre_commit_fragments.py +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.github/workflows/codeql-analysis.yml +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.github/workflows/draft_release.yml +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.github/workflows/format.yml +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.gitignore +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.sonarcloud.properties +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.yamllint +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/CLAUDE.md +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/LICENSE +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/cmake_pc_hooks/__init__.py +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/cmake_pc_hooks/_call_process.py +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/cmake_pre_commit_hooks.egg-info/dependency_links.txt +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/cmake_pre_commit_hooks.egg-info/entry_points.txt +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/cmake_pre_commit_hooks.egg-info/top_level.txt +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/codecov.yml +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/environment.yml +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/misc/license_header.txt +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/setup.cfg +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/setup.py +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/sonar-project.properties +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/cmake_bad/CMakeLists.txt +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/cmake_bad/bad.cpp +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/cmake_good/CMakeLists.txt +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/cmake_good/good.cpp +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/integration/_integration.py +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/integration/conftest.py +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/integration/pre_commit_test.py +0 -0
- {cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/tests/python/_call_process_test.py +0 -0
{cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.github/scripts/release_version.py
RENAMED
|
@@ -32,6 +32,7 @@ CHANGELOG = Path('CHANGELOG.md')
|
|
|
32
32
|
|
|
33
33
|
# Fragment types (see [tool.towncrier] in pyproject.toml) that users notice, and the version bump they call for
|
|
34
34
|
BUMPS = {
|
|
35
|
+
'breaking': 'major',
|
|
35
36
|
'added': 'minor',
|
|
36
37
|
'changed': 'minor',
|
|
37
38
|
'deprecated': 'minor',
|
|
@@ -62,6 +63,12 @@ def latest_version(changelog: str) -> tuple[int, int, int]:
|
|
|
62
63
|
return major, minor, patch
|
|
63
64
|
|
|
64
65
|
|
|
66
|
+
def largest_bump(types: set[str]) -> str | None:
|
|
67
|
+
"""Return the largest version bump that some fragment types call for, or None if they call for none."""
|
|
68
|
+
bumps = {BUMPS[kind] for kind in types if kind in BUMPS}
|
|
69
|
+
return next((bump for bump in ('major', 'minor', 'patch') if bump in bumps), None)
|
|
70
|
+
|
|
71
|
+
|
|
65
72
|
def next_version(request: str, types: set[str], latest: tuple[int, int, int]) -> str | None:
|
|
66
73
|
"""Return the version to release, or None if a scheduled run has nothing worth releasing."""
|
|
67
74
|
# The request is `auto`, `scheduled`, `patch`, `minor`, `major` or an explicit version. The bump for `auto` and
|
|
@@ -77,10 +84,10 @@ def next_version(request: str, types: set[str], latest: tuple[int, int, int]) ->
|
|
|
77
84
|
raise ValueError(msg)
|
|
78
85
|
|
|
79
86
|
if request in {'auto', 'scheduled'}:
|
|
80
|
-
|
|
81
|
-
if scheduled and
|
|
87
|
+
bump = largest_bump(types)
|
|
88
|
+
if scheduled and bump is None:
|
|
82
89
|
return None # only repository maintenance: not worth a release
|
|
83
|
-
request =
|
|
90
|
+
request = bump or 'patch'
|
|
84
91
|
|
|
85
92
|
major, minor, patch = latest
|
|
86
93
|
if request == 'major':
|
|
@@ -175,7 +175,9 @@ jobs:
|
|
|
175
175
|
run: python -m pytest tests/integration -v -ra -n auto --required-tools=all
|
|
176
176
|
|
|
177
177
|
- name: Run integration tests (Windows)
|
|
178
|
+
id: windows-tests
|
|
178
179
|
if: runner.os == 'Windows'
|
|
180
|
+
continue-on-error: ${{ matrix.python == '3.10' }}
|
|
179
181
|
env:
|
|
180
182
|
CC: cl
|
|
181
183
|
CXX: cl
|
|
@@ -184,6 +186,17 @@ jobs:
|
|
|
184
186
|
python -m pytest tests/integration -v -ra -n auto
|
|
185
187
|
--required-tools=clang-format,clang-tidy,cppcheck,cpplint,lizard,cmake,git,pre-commit
|
|
186
188
|
|
|
189
|
+
# Python 3.10 sometimes crashes at exit on Windows (issue #156)
|
|
190
|
+
- name: Retry failed integration tests (Windows, Python 3.10)
|
|
191
|
+
if: runner.os == 'Windows' && matrix.python == '3.10' && steps.windows-tests.outcome == 'failure'
|
|
192
|
+
env:
|
|
193
|
+
CC: cl
|
|
194
|
+
CXX: cl
|
|
195
|
+
LOGLEVEL: DEBUG
|
|
196
|
+
run: >-
|
|
197
|
+
python -m pytest tests/integration -v -ra -n auto --last-failed
|
|
198
|
+
--required-tools=clang-format,clang-tidy,cppcheck,cpplint,lizard,cmake,git,pre-commit
|
|
199
|
+
|
|
187
200
|
# NB: secrets are not available for pull requests coming from Dependabot or from forks. In those cases the
|
|
188
201
|
# coverage upload jobs below skip their steps instead of failing.
|
|
189
202
|
sonarcloud:
|
{cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.github/workflows/publish_release.yml
RENAMED
|
@@ -92,17 +92,18 @@ jobs:
|
|
|
92
92
|
name: pypi
|
|
93
93
|
url: https://pypi.org/project/cmake-pre-commit-hooks/${{ needs.build.outputs.version }}
|
|
94
94
|
permissions:
|
|
95
|
-
id-token: write # for PyPI trusted publishing
|
|
95
|
+
id-token: write # for PyPI trusted publishing and the provenance attestations uploaded with it
|
|
96
96
|
steps:
|
|
97
97
|
- uses: actions/download-artifact@v8
|
|
98
98
|
with:
|
|
99
99
|
name: release
|
|
100
100
|
|
|
101
|
+
# No API token on purpose: PyPI only accepts provenance attestations from trusted publishing
|
|
101
102
|
- name: Publish package
|
|
102
103
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
103
104
|
with:
|
|
104
|
-
password: ${{ secrets.pypi_password }}
|
|
105
105
|
packages-dir: dist/
|
|
106
|
+
attestations: true
|
|
106
107
|
|
|
107
108
|
github-release:
|
|
108
109
|
name: Create GitHub release
|
{cmake_pre_commit_hooks-1.10.0 → cmake_pre_commit_hooks-2.0.1}/.github/workflows/pull_request.yml
RENAMED
|
@@ -68,7 +68,7 @@ jobs:
|
|
|
68
68
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
69
69
|
HEAD_REF: ${{ github.event.pull_request.head.ref }}
|
|
70
70
|
# Keep in sync with the types defined in the [tool.towncrier] section of pyproject.toml
|
|
71
|
-
FRAGMENT_TYPES: added|changed|deprecated|removed|fixed|security|repository
|
|
71
|
+
FRAGMENT_TYPES: breaking|added|changed|deprecated|removed|fixed|security|repository
|
|
72
72
|
run: |
|
|
73
73
|
if [[ "${HEAD_REF}" == release/* || "${HEAD_REF}" == hotfix/* ]]; then
|
|
74
74
|
echo "Release pull request: the fragments are collected into CHANGELOG.md here"
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
|
|
3
|
+
minimum_pre_commit_version: 3.2.0
|
|
4
|
+
|
|
5
|
+
# Settings for https://pre-commit.ci
|
|
6
|
+
ci:
|
|
7
|
+
autoupdate_schedule: weekly
|
|
8
|
+
# NB: .github/workflows/pull_request.yml relies on this title to create the changelog fragments
|
|
9
|
+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
|
|
10
|
+
|
|
3
11
|
repos:
|
|
4
12
|
- repo: meta
|
|
5
13
|
hooks:
|
|
14
|
+
- id: check-hooks-apply
|
|
6
15
|
- id: check-useless-excludes
|
|
7
16
|
|
|
8
17
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
@@ -11,7 +20,6 @@ repos:
|
|
|
11
20
|
- id: check-added-large-files
|
|
12
21
|
- id: check-case-conflict
|
|
13
22
|
- id: check-merge-conflict
|
|
14
|
-
- id: check-symlinks
|
|
15
23
|
- id: check-yaml
|
|
16
24
|
- id: check-toml
|
|
17
25
|
- id: debug-statements
|
|
@@ -28,16 +36,9 @@ repos:
|
|
|
28
36
|
rev: v2.4.3
|
|
29
37
|
hooks:
|
|
30
38
|
- id: codespell
|
|
31
|
-
|
|
39
|
+
types_or: [python, plain-text, cmake, markdown, rst, shell, powershell, c++]
|
|
32
40
|
args: [-I, .codespell.allow]
|
|
33
41
|
|
|
34
|
-
- repo: https://github.com/shellcheck-py/shellcheck-py
|
|
35
|
-
rev: v0.11.0.1-1
|
|
36
|
-
hooks:
|
|
37
|
-
- id: shellcheck
|
|
38
|
-
require_serial: false
|
|
39
|
-
args: [-x, --severity=info]
|
|
40
|
-
|
|
41
42
|
- repo: https://github.com/adrienverge/yamllint.git
|
|
42
43
|
rev: v1.38.0
|
|
43
44
|
hooks:
|
|
@@ -7,51 +7,62 @@
|
|
|
7
7
|
name: clang-format
|
|
8
8
|
entry: cmake-pc-clang-format-hook
|
|
9
9
|
description: Formats C/CPP code
|
|
10
|
-
|
|
10
|
+
types_or: [c, c++, cuda, objective-c]
|
|
11
11
|
language: python
|
|
12
|
+
minimum_pre_commit_version: 3.2.0
|
|
12
13
|
- id: clang-tidy
|
|
13
14
|
name: clang-tidy
|
|
14
15
|
entry: cmake-pc-clang-tidy-hook
|
|
15
16
|
description: Find warnings/errors in C/CPP code
|
|
16
|
-
|
|
17
|
+
types_or: [c, c++, cuda, objective-c]
|
|
17
18
|
language: python
|
|
19
|
+
minimum_pre_commit_version: 3.2.0
|
|
18
20
|
- id: cppcheck
|
|
19
21
|
name: cppcheck (system)
|
|
20
22
|
entry: cmake-pc-cppcheck-hook
|
|
21
23
|
description: Find warnings/errors in C/CPP code
|
|
22
24
|
# NB: no h|hpp|hxx here since we are calling cppcheck with --project=/path/to/compile_commands.json which does not
|
|
23
|
-
# contain header files
|
|
25
|
+
# contain header files. This is also why this hook does not use `types_or`: the c++ type includes files such as
|
|
26
|
+
# .inl, .ipp or .tpp that are not part of the compilation database either
|
|
24
27
|
files: \.(c|c\+\+m|cc|ccm|cpp|cppm|cu|cxx|cxxm|ixx|m|mxx)$
|
|
25
28
|
language: python
|
|
29
|
+
minimum_pre_commit_version: 3.2.0
|
|
26
30
|
- id: cppcheck-conda
|
|
27
31
|
name: cppcheck (conda)
|
|
28
32
|
entry: cmake-pc-cppcheck-hook
|
|
29
33
|
description: Find warnings/errors in C/CPP code
|
|
30
34
|
# NB: no h|hpp|hxx here since we are calling cppcheck with --project=/path/to/compile_commands.json which does not
|
|
31
|
-
# contain header files
|
|
35
|
+
# contain header files. This is also why this hook does not use `types_or`: the c++ type includes files such as
|
|
36
|
+
# .inl, .ipp or .tpp that are not part of the compilation database either
|
|
32
37
|
files: \.(c|c\+\+m|cc|ccm|cpp|cppm|cu|cxx|cxxm|ixx|m|mxx)$
|
|
33
38
|
language: conda
|
|
39
|
+
minimum_pre_commit_version: 3.2.0
|
|
34
40
|
- id: cpplint
|
|
35
41
|
name: cpplint
|
|
36
42
|
entry: cmake-pc-cpplint-hook
|
|
37
43
|
description: Find warnings/errors in C/CPP code
|
|
38
|
-
|
|
44
|
+
types_or: [c, c++, cuda]
|
|
39
45
|
language: python
|
|
46
|
+
minimum_pre_commit_version: 3.2.0
|
|
40
47
|
- id: include-what-you-use
|
|
41
48
|
name: include-what-you-use (system)
|
|
42
49
|
entry: cmake-pc-include-what-you-use-hook
|
|
43
50
|
description: Find unused include directives in C/CPP code
|
|
44
|
-
|
|
51
|
+
types_or: [c, c++, cuda, objective-c]
|
|
45
52
|
language: python
|
|
53
|
+
minimum_pre_commit_version: 3.2.0
|
|
46
54
|
- id: include-what-you-use-conda
|
|
47
55
|
name: include-what-you-use (conda)
|
|
48
56
|
entry: cmake-pc-include-what-you-use-hook
|
|
49
57
|
description: Find unused include directives in C/CPP code
|
|
50
|
-
|
|
58
|
+
types_or: [c, c++, cuda, objective-c]
|
|
51
59
|
language: conda
|
|
60
|
+
minimum_pre_commit_version: 3.2.0
|
|
52
61
|
- id: lizard
|
|
53
62
|
name: lizard
|
|
54
63
|
entry: cmake-pc-lizard-hook
|
|
55
64
|
description: Code complexity analyzer for C/CPP/ObjC/...
|
|
65
|
+
# NB: no `types_or` here since some of the Fortran extensions (.f, .F, .F90, ...) have no type in pre-commit
|
|
56
66
|
files: \.(F|F03|F90|F95|c|c\+\+m|cc|ccm|cpp|cppm|cu|cuh|cxx|cxxm|f|f03|f90|f95|h|hh|hpp|hxx|ixx|mxx|py)$
|
|
57
67
|
language: python
|
|
68
|
+
minimum_pre_commit_version: 3.2.0
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Do not edit `CHANGELOG.md`. Add a new file in `changelog.d/` instead. CI fails without one. Dependabot and release pull requests do not need one.
|
|
6
6
|
|
|
7
7
|
- **Name:** `changelog.d/+<short-description>.<type>.md`
|
|
8
|
-
- **Type:** `added`, `changed`, `deprecated`, `removed`, `fixed`, `security`, or `repository` (CI, tooling, tests, docs)
|
|
8
|
+
- **Type:** `breaking`, `added`, `changed`, `deprecated`, `removed`, `fixed`, `security`, or `repository` (CI, tooling, tests, docs)
|
|
9
9
|
- **Content:** one sentence on one line, with no heading and no leading `- `
|
|
10
10
|
|
|
11
11
|
Example, `changelog.d/+lizard-exit-code.fixed.md`:
|
|
@@ -9,6 +9,54 @@ Changes that are not released yet are stored as fragments in the [changelog.d](c
|
|
|
9
9
|
|
|
10
10
|
<!-- towncrier release notes start -->
|
|
11
11
|
|
|
12
|
+
## [v2.0.1](https://github.com/Takishima/cmake-pre-commit-hooks/releases/tag/v2.0.1) - 2026-11-22
|
|
13
|
+
|
|
14
|
+
### Repository
|
|
15
|
+
|
|
16
|
+
- Publish releases to PyPI with trusted publishing so that the uploaded files carry provenance attestations
|
|
17
|
+
|
|
18
|
+
## [v2.0.0](https://github.com/Takishima/cmake-pre-commit-hooks/releases/tag/v2.0.0) - 2026-11-22
|
|
19
|
+
|
|
20
|
+
### Breaking changes
|
|
21
|
+
|
|
22
|
+
- Rename the version check from `--version` to `--require-version`; the hook now runs the tool after a successful check, and `--version` shows the version of the hooks ([#163](https://github.com/Takishima/cmake-pre-commit-hooks/issues/163))
|
|
23
|
+
- Make all hooks fail when there is no file to process (unless `--all-at-once` is used), as the hooks using CMake already did
|
|
24
|
+
- Rename the option to specify a TOML file from `--config` to `--hooks-config`; `--config` is now passed on to the underlying tool
|
|
25
|
+
- Select the files of the `clang-format`, `clang-tidy`, `cpplint` and `include-what-you-use` hooks with `types_or` instead of a list of extensions: more C/C++ extensions are now matched (e.g. `.hh`, `.inl`, `.ipp`, `.tpp`, `.mm`) but `.mxx` files no longer are, unless `types_or` and `files` are overridden in the configuration of the hook
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- Support settings for a single hook in TOML files, in a table named after the hook (e.g. `[tool.cmake_pc_hooks.clang-tidy]`)
|
|
30
|
+
- Support the common hook options and the TOML configuration in the `cpplint` hook, which now also reports the errors of all the files instead of stopping at the first failing one
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- Parse the command line with `click` and read TOML files with the standard library, removing the `toml` dependency ([#160](https://github.com/Takishima/cmake-pre-commit-hooks/issues/160))
|
|
35
|
+
- Declare `minimum_pre_commit_version: 3.2.0` for all the hooks, so that older versions of pre-commit fail with a clear message
|
|
36
|
+
- Only look for and set up CMake when a hook needs it, which also makes `--read-json-db` work with the `clang-format` hook
|
|
37
|
+
- Print the output of a tool as soon as each file is processed instead of at the end, and always exit with code 1 on failure
|
|
38
|
+
- Remove the dependency on the `CLinters` package by implementing the base classes of the hooks in this package
|
|
39
|
+
- Report a clear error instead of a traceback when the tool of a hook is not installed
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- Fix the hooks passing a compilation database that does not exist to the tool when `--no-cmake-configure` is used, and look for one in the other build directories ([#154](https://github.com/Takishima/cmake-pre-commit-hooks/issues/154))
|
|
44
|
+
- Fix `-S` accepting a path that is not a directory, and check it for all hooks
|
|
45
|
+
- Fix a TOML file passed on the command line not overriding the settings of `pyproject.toml` and `cmake_pc_hooks.toml`
|
|
46
|
+
- Fix clang-format hook failing on empty files
|
|
47
|
+
- Fix the `unix` setting having no effect when set in a TOML file
|
|
48
|
+
|
|
49
|
+
### Repository
|
|
50
|
+
|
|
51
|
+
- Split the CMake code into a package of focused modules with a typed options object ([#150](https://github.com/Takishima/cmake-pre-commit-hooks/issues/150))
|
|
52
|
+
- Retry failed integration tests once on Windows with Python 3.10, which sometimes crashes at exit ([#156](https://github.com/Takishima/cmake-pre-commit-hooks/issues/156))
|
|
53
|
+
- Fix the name of the package directory in `MANIFEST.in` ([#157](https://github.com/Takishima/cmake-pre-commit-hooks/issues/157))
|
|
54
|
+
- Add a `breaking` changelog fragment type, which makes the release workflow propose a major version
|
|
55
|
+
- Exclude the changelog fragments from the Codacy analysis
|
|
56
|
+
- Fix the minimum Python version stated in the README (3.10, not 3.8)
|
|
57
|
+
- Make the pre-commit.ci settings explicit, add the `check-hooks-apply` meta hook and remove the `check-symlinks` and `shellcheck` hooks that it reports as not matching any file
|
|
58
|
+
- Run all hooks through one shared runner, with each hook reduced to a short description of its tool
|
|
59
|
+
|
|
12
60
|
## [v1.10.0](https://github.com/Takishima/cmake-pre-commit-hooks/releases/tag/v1.10.0) - 2026-11-22
|
|
13
61
|
|
|
14
62
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cmake_pre_commit_hooks
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: pre-commit hooks for CMake-based projects
|
|
5
5
|
Author-email: Damien Nguyen <ngn.damien@gmail.com>
|
|
6
6
|
License: Apache2
|
|
@@ -21,8 +21,8 @@ Classifier: Programming Language :: Python :: 3.15
|
|
|
21
21
|
Requires-Python: >=3.10
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist:
|
|
24
|
+
Requires-Dist: click>=8.1
|
|
25
|
+
Requires-Dist: tomli; python_version < "3.11"
|
|
26
26
|
Requires-Dist: fasteners
|
|
27
27
|
Requires-Dist: attrs>=23
|
|
28
28
|
Requires-Dist: lizard
|
|
@@ -67,9 +67,6 @@ This repository is only has Python-based pre-commit hooks.
|
|
|
67
67
|
1. Currently, the hooks that depend on having a compilation database generated by CMake (e.g. `clang-tidy`, `cppcheck`)
|
|
68
68
|
are not working on Windows if you are not using the `Ninja` or `Makefile` generators.
|
|
69
69
|
|
|
70
|
-
2. Currently, arguments set in a TOML configuration file (`pyproject.toml`, `cmake_pc_hooks.toml` or else) are applied
|
|
71
|
-
to all hooks. Future improvements may allow to customize arguments on a per-hook basis.
|
|
72
|
-
|
|
73
70
|
## Example usage
|
|
74
71
|
|
|
75
72
|
Assuming that you have the following directory structure for your projects
|
|
@@ -163,8 +160,7 @@ Note that your mileage may vary depending on the version of the tools. The examp
|
|
|
163
160
|
|
|
164
161
|
## Using the Hooks
|
|
165
162
|
|
|
166
|
-
Python 3.
|
|
167
|
-
version of pre-commit, this should not be an issue.
|
|
163
|
+
Python 3.10+ is required to use these hooks, as all of them are written in Python.
|
|
168
164
|
|
|
169
165
|
Running multiple hooks in parallel is currently supported by using the `fastener` Python package. If the hooks are run
|
|
170
166
|
in parallel, only one of the hooks will run the CMake configure step while the others will simply wait until the call to
|
|
@@ -238,9 +234,12 @@ In addition to the above CMake options, the hooks also accept the following:
|
|
|
238
234
|
| `--codegen` | Build the CMake `codegen` target (CMake >= 3.31) | Unreleased |
|
|
239
235
|
| `--detect-configured-files` | Enable cmake tracing and detection of configured files | Since v1.9.0 |
|
|
240
236
|
| `--dump-toml` | Dump the current configuration as TOML on stdout | Since v1.9.0 |
|
|
237
|
+
| `--hooks-config` | Path to a TOML configuration file | Unreleased |
|
|
241
238
|
| `--no-automatic-discovery` | Disable automatic build directory discovery | Since v1.9.0 |
|
|
242
239
|
| `--no-cmake-configure` | Do not call CMake configure | Since v1.9.2 |
|
|
243
240
|
| `--read-json-db` | Append file list from compile database | Since v1.7.0 |
|
|
241
|
+
| `--require-version` | Fail unless the tool version starts with this value | Unreleased |
|
|
242
|
+
| `--version` | Show the version of the hooks and exit | Unreleased |
|
|
244
243
|
| `--linux` | Linux-only CMake options | Since v1.3.0 |
|
|
245
244
|
| `--mac` | MacOS-only CMake options | Since v1.3.0 |
|
|
246
245
|
| `--win` | Windows-only CMake options | Since v1.3.0 |
|
|
@@ -248,6 +247,22 @@ In addition to the above CMake options, the hooks also accept the following:
|
|
|
248
247
|
NB: by specifying `--all-at-once` the linter/formatter command will only be called once for all the files instead of
|
|
249
248
|
calling the command once per file.
|
|
250
249
|
|
|
250
|
+
NB: `--require-version=18.1` makes a hook fail unless the version of its tool starts with `18.1`. If the version
|
|
251
|
+
matches, the hook then runs as usual.
|
|
252
|
+
|
|
253
|
+
**Breaking change (unreleased):** the version check was renamed from `--version` to `--require-version` (`version` to
|
|
254
|
+
`require_version` in TOML files), and a hook no longer stops after a successful check. `--version` now shows the version
|
|
255
|
+
of the hooks:
|
|
256
|
+
|
|
257
|
+
```yaml
|
|
258
|
+
# Before
|
|
259
|
+
args: [--version=18.1]
|
|
260
|
+
# After
|
|
261
|
+
args: [--require-version=18.1]
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
NB: the `cpplint` hook accepts the same options and TOML configuration as the other hooks (unreleased).
|
|
265
|
+
|
|
251
266
|
NB: Since v1.6.0, the `--debug` command line argument has been removed. Use the `LOGLEVEL` environment variable instead
|
|
252
267
|
to control the level of verbosity of each of the commands. To show all debug messages, set `LOGLEVEL=DEBUG` in your
|
|
253
268
|
environment variables when running the hooks.
|
|
@@ -302,34 +317,74 @@ Also, builds on Linux and MacOS will set the C++ compiler to `g++-10`, while bui
|
|
|
302
317
|
|
|
303
318
|
### TOML support
|
|
304
319
|
|
|
305
|
-
Since v1.9.0, the hooks support loading the CLI arguments from TOML files. This can be used to configure
|
|
306
|
-
|
|
320
|
+
Since v1.9.0, the hooks support loading the CLI arguments from TOML files. This can be used to configure the hooks for
|
|
321
|
+
a particular repository using either of:
|
|
307
322
|
|
|
308
323
|
1. `pyproject.toml` (under `tool.cmake_pc_hooks` section)
|
|
309
324
|
2. `cmake_pc_hooks.toml`
|
|
310
|
-
3. TOML file specified using `--config=/path/to/file.toml`
|
|
325
|
+
3. TOML file specified using `--hooks-config=/path/to/file.toml`
|
|
311
326
|
4. Command line arguments
|
|
312
327
|
|
|
313
328
|
Note that each step in the above list is overridden by the steps that happen **after** it. For example, CLI arguments
|
|
314
329
|
will always override any arguments read from any TOML file.
|
|
315
330
|
|
|
331
|
+
**Breaking change (unreleased):** the option to specify a TOML file was renamed from `--config` to `--hooks-config`.
|
|
332
|
+
`--config` is now passed on to the underlying tool (e.g. `clang-tidy --config=...`):
|
|
333
|
+
|
|
334
|
+
```yaml
|
|
335
|
+
# Before
|
|
336
|
+
args: [--config=hooks.toml]
|
|
337
|
+
# After
|
|
338
|
+
args: [--hooks-config=hooks.toml]
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
An option that is not known to the hooks, or a value of the wrong type, is an error.
|
|
342
|
+
|
|
343
|
+
#### Settings for a single hook
|
|
344
|
+
|
|
345
|
+
Settings placed in a table named after a hook only apply to that hook, and override the common ones from the same
|
|
346
|
+
file. The table names are the hook names: `clang-format`, `clang-tidy`, `cppcheck`, `cpplint`, `include-what-you-use`
|
|
347
|
+
and `lizard`.
|
|
348
|
+
|
|
349
|
+
In `pyproject.toml`:
|
|
350
|
+
|
|
351
|
+
```toml
|
|
352
|
+
[tool.cmake_pc_hooks]
|
|
353
|
+
build_dir = ["build"]
|
|
354
|
+
|
|
355
|
+
[tool.cmake_pc_hooks.clang-tidy]
|
|
356
|
+
all_at_once = true
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
In `cmake_pc_hooks.toml` (or a file passed with `--hooks-config`):
|
|
360
|
+
|
|
361
|
+
```toml
|
|
362
|
+
build_dir = ["build"]
|
|
363
|
+
|
|
364
|
+
[clang-tidy]
|
|
365
|
+
all_at_once = true
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
#### Creating a TOML file
|
|
369
|
+
|
|
316
370
|
A good place to start if you plan on creating a TOML configuration file is to use the hooks using the CLI arguments as
|
|
317
371
|
you would normally and then run the hook manually and with the addition of `--dump-toml`. This will output a
|
|
318
|
-
TOML-formatted configuration on the standard output for all the parameters that
|
|
372
|
+
TOML-formatted configuration on the standard output for all the parameters that were set, either on the command line or
|
|
373
|
+
in a TOML file.
|
|
319
374
|
|
|
320
375
|
For example, running the following command (assuming that no valid TOML configuration exists):
|
|
321
376
|
|
|
322
377
|
```bash
|
|
323
|
-
cmake-pc-clang-format-hook tests/cmake_bad/bad.cpp
|
|
378
|
+
cmake-pc-clang-format-hook tests/cmake_bad/bad.cpp --dump-toml -B /tmp/build -S tests/cmake_bad -Wdev --no-automatic-discovery
|
|
324
379
|
```
|
|
325
380
|
|
|
326
381
|
will result in the following output:
|
|
327
382
|
|
|
328
383
|
```toml
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
build_dir = [ "/tmp/build",]
|
|
384
|
+
source_dir = "tests/cmake_bad"
|
|
385
|
+
build_dir = ["/tmp/build"]
|
|
332
386
|
dev_warnings = true
|
|
387
|
+
automatic_discovery = false
|
|
333
388
|
```
|
|
334
389
|
|
|
335
390
|
### CMake configured file detection
|
|
@@ -24,9 +24,6 @@ This repository is only has Python-based pre-commit hooks.
|
|
|
24
24
|
1. Currently, the hooks that depend on having a compilation database generated by CMake (e.g. `clang-tidy`, `cppcheck`)
|
|
25
25
|
are not working on Windows if you are not using the `Ninja` or `Makefile` generators.
|
|
26
26
|
|
|
27
|
-
2. Currently, arguments set in a TOML configuration file (`pyproject.toml`, `cmake_pc_hooks.toml` or else) are applied
|
|
28
|
-
to all hooks. Future improvements may allow to customize arguments on a per-hook basis.
|
|
29
|
-
|
|
30
27
|
## Example usage
|
|
31
28
|
|
|
32
29
|
Assuming that you have the following directory structure for your projects
|
|
@@ -120,8 +117,7 @@ Note that your mileage may vary depending on the version of the tools. The examp
|
|
|
120
117
|
|
|
121
118
|
## Using the Hooks
|
|
122
119
|
|
|
123
|
-
Python 3.
|
|
124
|
-
version of pre-commit, this should not be an issue.
|
|
120
|
+
Python 3.10+ is required to use these hooks, as all of them are written in Python.
|
|
125
121
|
|
|
126
122
|
Running multiple hooks in parallel is currently supported by using the `fastener` Python package. If the hooks are run
|
|
127
123
|
in parallel, only one of the hooks will run the CMake configure step while the others will simply wait until the call to
|
|
@@ -195,9 +191,12 @@ In addition to the above CMake options, the hooks also accept the following:
|
|
|
195
191
|
| `--codegen` | Build the CMake `codegen` target (CMake >= 3.31) | Unreleased |
|
|
196
192
|
| `--detect-configured-files` | Enable cmake tracing and detection of configured files | Since v1.9.0 |
|
|
197
193
|
| `--dump-toml` | Dump the current configuration as TOML on stdout | Since v1.9.0 |
|
|
194
|
+
| `--hooks-config` | Path to a TOML configuration file | Unreleased |
|
|
198
195
|
| `--no-automatic-discovery` | Disable automatic build directory discovery | Since v1.9.0 |
|
|
199
196
|
| `--no-cmake-configure` | Do not call CMake configure | Since v1.9.2 |
|
|
200
197
|
| `--read-json-db` | Append file list from compile database | Since v1.7.0 |
|
|
198
|
+
| `--require-version` | Fail unless the tool version starts with this value | Unreleased |
|
|
199
|
+
| `--version` | Show the version of the hooks and exit | Unreleased |
|
|
201
200
|
| `--linux` | Linux-only CMake options | Since v1.3.0 |
|
|
202
201
|
| `--mac` | MacOS-only CMake options | Since v1.3.0 |
|
|
203
202
|
| `--win` | Windows-only CMake options | Since v1.3.0 |
|
|
@@ -205,6 +204,22 @@ In addition to the above CMake options, the hooks also accept the following:
|
|
|
205
204
|
NB: by specifying `--all-at-once` the linter/formatter command will only be called once for all the files instead of
|
|
206
205
|
calling the command once per file.
|
|
207
206
|
|
|
207
|
+
NB: `--require-version=18.1` makes a hook fail unless the version of its tool starts with `18.1`. If the version
|
|
208
|
+
matches, the hook then runs as usual.
|
|
209
|
+
|
|
210
|
+
**Breaking change (unreleased):** the version check was renamed from `--version` to `--require-version` (`version` to
|
|
211
|
+
`require_version` in TOML files), and a hook no longer stops after a successful check. `--version` now shows the version
|
|
212
|
+
of the hooks:
|
|
213
|
+
|
|
214
|
+
```yaml
|
|
215
|
+
# Before
|
|
216
|
+
args: [--version=18.1]
|
|
217
|
+
# After
|
|
218
|
+
args: [--require-version=18.1]
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
NB: the `cpplint` hook accepts the same options and TOML configuration as the other hooks (unreleased).
|
|
222
|
+
|
|
208
223
|
NB: Since v1.6.0, the `--debug` command line argument has been removed. Use the `LOGLEVEL` environment variable instead
|
|
209
224
|
to control the level of verbosity of each of the commands. To show all debug messages, set `LOGLEVEL=DEBUG` in your
|
|
210
225
|
environment variables when running the hooks.
|
|
@@ -259,34 +274,74 @@ Also, builds on Linux and MacOS will set the C++ compiler to `g++-10`, while bui
|
|
|
259
274
|
|
|
260
275
|
### TOML support
|
|
261
276
|
|
|
262
|
-
Since v1.9.0, the hooks support loading the CLI arguments from TOML files. This can be used to configure
|
|
263
|
-
|
|
277
|
+
Since v1.9.0, the hooks support loading the CLI arguments from TOML files. This can be used to configure the hooks for
|
|
278
|
+
a particular repository using either of:
|
|
264
279
|
|
|
265
280
|
1. `pyproject.toml` (under `tool.cmake_pc_hooks` section)
|
|
266
281
|
2. `cmake_pc_hooks.toml`
|
|
267
|
-
3. TOML file specified using `--config=/path/to/file.toml`
|
|
282
|
+
3. TOML file specified using `--hooks-config=/path/to/file.toml`
|
|
268
283
|
4. Command line arguments
|
|
269
284
|
|
|
270
285
|
Note that each step in the above list is overridden by the steps that happen **after** it. For example, CLI arguments
|
|
271
286
|
will always override any arguments read from any TOML file.
|
|
272
287
|
|
|
288
|
+
**Breaking change (unreleased):** the option to specify a TOML file was renamed from `--config` to `--hooks-config`.
|
|
289
|
+
`--config` is now passed on to the underlying tool (e.g. `clang-tidy --config=...`):
|
|
290
|
+
|
|
291
|
+
```yaml
|
|
292
|
+
# Before
|
|
293
|
+
args: [--config=hooks.toml]
|
|
294
|
+
# After
|
|
295
|
+
args: [--hooks-config=hooks.toml]
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
An option that is not known to the hooks, or a value of the wrong type, is an error.
|
|
299
|
+
|
|
300
|
+
#### Settings for a single hook
|
|
301
|
+
|
|
302
|
+
Settings placed in a table named after a hook only apply to that hook, and override the common ones from the same
|
|
303
|
+
file. The table names are the hook names: `clang-format`, `clang-tidy`, `cppcheck`, `cpplint`, `include-what-you-use`
|
|
304
|
+
and `lizard`.
|
|
305
|
+
|
|
306
|
+
In `pyproject.toml`:
|
|
307
|
+
|
|
308
|
+
```toml
|
|
309
|
+
[tool.cmake_pc_hooks]
|
|
310
|
+
build_dir = ["build"]
|
|
311
|
+
|
|
312
|
+
[tool.cmake_pc_hooks.clang-tidy]
|
|
313
|
+
all_at_once = true
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
In `cmake_pc_hooks.toml` (or a file passed with `--hooks-config`):
|
|
317
|
+
|
|
318
|
+
```toml
|
|
319
|
+
build_dir = ["build"]
|
|
320
|
+
|
|
321
|
+
[clang-tidy]
|
|
322
|
+
all_at_once = true
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
#### Creating a TOML file
|
|
326
|
+
|
|
273
327
|
A good place to start if you plan on creating a TOML configuration file is to use the hooks using the CLI arguments as
|
|
274
328
|
you would normally and then run the hook manually and with the addition of `--dump-toml`. This will output a
|
|
275
|
-
TOML-formatted configuration on the standard output for all the parameters that
|
|
329
|
+
TOML-formatted configuration on the standard output for all the parameters that were set, either on the command line or
|
|
330
|
+
in a TOML file.
|
|
276
331
|
|
|
277
332
|
For example, running the following command (assuming that no valid TOML configuration exists):
|
|
278
333
|
|
|
279
334
|
```bash
|
|
280
|
-
cmake-pc-clang-format-hook tests/cmake_bad/bad.cpp
|
|
335
|
+
cmake-pc-clang-format-hook tests/cmake_bad/bad.cpp --dump-toml -B /tmp/build -S tests/cmake_bad -Wdev --no-automatic-discovery
|
|
281
336
|
```
|
|
282
337
|
|
|
283
338
|
will result in the following output:
|
|
284
339
|
|
|
285
340
|
```toml
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
build_dir = [ "/tmp/build",]
|
|
341
|
+
source_dir = "tests/cmake_bad"
|
|
342
|
+
build_dir = ["/tmp/build"]
|
|
289
343
|
dev_warnings = true
|
|
344
|
+
automatic_discovery = false
|
|
290
345
|
```
|
|
291
346
|
|
|
292
347
|
### CMake configured file detection
|
|
@@ -12,6 +12,7 @@ changelog.d/+<short-description>.<type>.md (when there is no number yet)
|
|
|
12
12
|
|
|
13
13
|
| Type | Use it for |
|
|
14
14
|
| ------------ | ----------------------------------------------------------------- |
|
|
15
|
+
| `breaking` | Changes that require users to update their configuration |
|
|
15
16
|
| `added` | New hooks, options or other features |
|
|
16
17
|
| `changed` | Changes in existing behaviour (including dropped Python versions) |
|
|
17
18
|
| `deprecated` | Features that will be removed in a future release |
|