pytest-cppcheck 0.1.0__tar.gz → 0.1.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alex DeJarnatt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,136 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytest-cppcheck
3
+ Version: 0.1.1
4
+ Summary: A pytest plugin that runs cppcheck static analysis on C/C++ source files
5
+ Author-email: Alex DeJarnatt <adejarnatt@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Alex DeJarnatt
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/alexdej/pytest-cppcheck
29
+ Project-URL: Repository, https://github.com/alexdej/pytest-cppcheck
30
+ Classifier: Framework :: Pytest
31
+ Classifier: Programming Language :: Python :: 3
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Requires-Python: >=3.8
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE
36
+ Requires-Dist: pytest>=7.0
37
+ Requires-Dist: cppcheck>=1.4.0
38
+ Dynamic: license-file
39
+
40
+ # pytest-cppcheck
41
+
42
+ A pytest plugin that runs [cppcheck](https://cppcheck.sourceforge.io/) static
43
+ analysis on C/C++ source files. Each file is collected as a test item and
44
+ reported as a pass or failure in the normal pytest output.
45
+
46
+ Useful for Python projects with C extension modules where you already run pytest
47
+ and want cppcheck findings surfaced in the same test run.
48
+
49
+ ## Installation
50
+
51
+ ```
52
+ pip install pytest-cppcheck
53
+ ```
54
+
55
+ This pulls in cppcheck automatically via the
56
+ [cppcheck](https://pypi.org/project/cppcheck/) PyPI package. If you prefer a
57
+ specific version, install cppcheck yourself via your system package manager
58
+ (`apt install cppcheck`, `brew install cppcheck`, etc.) — the plugin uses
59
+ whichever `cppcheck` is on PATH.
60
+
61
+ ## Usage
62
+
63
+ The plugin does nothing unless explicitly enabled:
64
+
65
+ ```
66
+ pytest --cppcheck
67
+ ```
68
+
69
+ This collects all `.c` and `.cpp` files and runs cppcheck on each one.
70
+ Files with findings fail; clean files pass.
71
+
72
+ ```
73
+ PASSED src/clean.c::CPPCHECK
74
+ FAILED src/buggy.c::CPPCHECK
75
+ src/buggy.c:42:8: error: Array 'arr[10]' accessed at index 10, which is
76
+ out of bounds. [arrayIndexOutOfBounds]
77
+ ```
78
+
79
+ You can combine `--cppcheck` with your normal test run — Python tests and
80
+ cppcheck items appear together in the results.
81
+
82
+ ## Configuration
83
+
84
+ All options go in `pyproject.toml`, `pytest.ini`, or `setup.cfg` under `[pytest]`.
85
+
86
+ ### `cppcheck_args`
87
+
88
+ Extra arguments forwarded to every cppcheck invocation. This is the main
89
+ configuration surface — use it for `--enable`, `--suppress`, and any other
90
+ cppcheck flags. The plugin always passes `--quiet` and `--error-exitcode=1`
91
+ automatically.
92
+
93
+ With no `cppcheck_args`, cppcheck runs its default checks (mostly
94
+ error-severity). Use `--enable` to broaden coverage. A good starting
95
+ configuration:
96
+
97
+ ```ini
98
+ [pytest]
99
+ cppcheck_args =
100
+ --enable=warning,style,performance,portability
101
+ --suppress=missingIncludeSystem
102
+ --suppress=normalCheckLevelMaxBranches
103
+ ```
104
+
105
+ `missingIncludeSystem` suppresses noise about system headers that aren't
106
+ available to cppcheck. `normalCheckLevelMaxBranches` suppresses an
107
+ informational message that cppcheck emits on complex files and that would
108
+ otherwise be reported as a failure.
109
+
110
+ ### `cppcheck_extensions`
111
+
112
+ File extensions to collect. Default: `.c .cpp`.
113
+
114
+ ```ini
115
+ [pytest]
116
+ cppcheck_extensions = .c .cpp .h
117
+ ```
118
+
119
+ ## Caching
120
+
121
+ Results are cached based on file modification time and `cppcheck_args`. On
122
+ subsequent runs, files that previously passed are skipped. The cache is
123
+ automatically invalidated when a file is modified or `cppcheck_args` changes.
124
+ Caching relies on pytest's built-in cache provider (the `.pytest_cache` directory).
125
+ If the cache provider is disabled (for example with `-p no:cacheprovider`), results
126
+ will not be cached and all files will be re-checked on each run.
127
+
128
+ To force a full re-check:
129
+
130
+ ```
131
+ pytest --cppcheck --cache-clear
132
+ ```
133
+
134
+ ## License
135
+
136
+ MIT
@@ -4,8 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pytest-cppcheck"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "A pytest plugin that runs cppcheck static analysis on C/C++ source files"
9
+ readme = "README.md"
10
+ license = {file = "LICENSE"}
11
+ authors = [
12
+ { name = "Alex DeJarnatt", email = "adejarnatt@gmail.com" },
13
+ ]
9
14
  requires-python = ">=3.8"
10
15
  dependencies = [
11
16
  "pytest>=7.0",
@@ -17,6 +22,10 @@ classifiers = [
17
22
  "License :: OSI Approved :: MIT License",
18
23
  ]
19
24
 
25
+ [project.urls]
26
+ Homepage = "https://github.com/alexdej/pytest-cppcheck"
27
+ Repository = "https://github.com/alexdej/pytest-cppcheck"
28
+
20
29
  [project.entry-points."pytest11"]
21
30
  cppcheck = "pytest_cppcheck.plugin"
22
31
 
@@ -0,0 +1,136 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytest-cppcheck
3
+ Version: 0.1.1
4
+ Summary: A pytest plugin that runs cppcheck static analysis on C/C++ source files
5
+ Author-email: Alex DeJarnatt <adejarnatt@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Alex DeJarnatt
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/alexdej/pytest-cppcheck
29
+ Project-URL: Repository, https://github.com/alexdej/pytest-cppcheck
30
+ Classifier: Framework :: Pytest
31
+ Classifier: Programming Language :: Python :: 3
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Requires-Python: >=3.8
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE
36
+ Requires-Dist: pytest>=7.0
37
+ Requires-Dist: cppcheck>=1.4.0
38
+ Dynamic: license-file
39
+
40
+ # pytest-cppcheck
41
+
42
+ A pytest plugin that runs [cppcheck](https://cppcheck.sourceforge.io/) static
43
+ analysis on C/C++ source files. Each file is collected as a test item and
44
+ reported as a pass or failure in the normal pytest output.
45
+
46
+ Useful for Python projects with C extension modules where you already run pytest
47
+ and want cppcheck findings surfaced in the same test run.
48
+
49
+ ## Installation
50
+
51
+ ```
52
+ pip install pytest-cppcheck
53
+ ```
54
+
55
+ This pulls in cppcheck automatically via the
56
+ [cppcheck](https://pypi.org/project/cppcheck/) PyPI package. If you prefer a
57
+ specific version, install cppcheck yourself via your system package manager
58
+ (`apt install cppcheck`, `brew install cppcheck`, etc.) — the plugin uses
59
+ whichever `cppcheck` is on PATH.
60
+
61
+ ## Usage
62
+
63
+ The plugin does nothing unless explicitly enabled:
64
+
65
+ ```
66
+ pytest --cppcheck
67
+ ```
68
+
69
+ This collects all `.c` and `.cpp` files and runs cppcheck on each one.
70
+ Files with findings fail; clean files pass.
71
+
72
+ ```
73
+ PASSED src/clean.c::CPPCHECK
74
+ FAILED src/buggy.c::CPPCHECK
75
+ src/buggy.c:42:8: error: Array 'arr[10]' accessed at index 10, which is
76
+ out of bounds. [arrayIndexOutOfBounds]
77
+ ```
78
+
79
+ You can combine `--cppcheck` with your normal test run — Python tests and
80
+ cppcheck items appear together in the results.
81
+
82
+ ## Configuration
83
+
84
+ All options go in `pyproject.toml`, `pytest.ini`, or `setup.cfg` under `[pytest]`.
85
+
86
+ ### `cppcheck_args`
87
+
88
+ Extra arguments forwarded to every cppcheck invocation. This is the main
89
+ configuration surface — use it for `--enable`, `--suppress`, and any other
90
+ cppcheck flags. The plugin always passes `--quiet` and `--error-exitcode=1`
91
+ automatically.
92
+
93
+ With no `cppcheck_args`, cppcheck runs its default checks (mostly
94
+ error-severity). Use `--enable` to broaden coverage. A good starting
95
+ configuration:
96
+
97
+ ```ini
98
+ [pytest]
99
+ cppcheck_args =
100
+ --enable=warning,style,performance,portability
101
+ --suppress=missingIncludeSystem
102
+ --suppress=normalCheckLevelMaxBranches
103
+ ```
104
+
105
+ `missingIncludeSystem` suppresses noise about system headers that aren't
106
+ available to cppcheck. `normalCheckLevelMaxBranches` suppresses an
107
+ informational message that cppcheck emits on complex files and that would
108
+ otherwise be reported as a failure.
109
+
110
+ ### `cppcheck_extensions`
111
+
112
+ File extensions to collect. Default: `.c .cpp`.
113
+
114
+ ```ini
115
+ [pytest]
116
+ cppcheck_extensions = .c .cpp .h
117
+ ```
118
+
119
+ ## Caching
120
+
121
+ Results are cached based on file modification time and `cppcheck_args`. On
122
+ subsequent runs, files that previously passed are skipped. The cache is
123
+ automatically invalidated when a file is modified or `cppcheck_args` changes.
124
+ Caching relies on pytest's built-in cache provider (the `.pytest_cache` directory).
125
+ If the cache provider is disabled (for example with `-p no:cacheprovider`), results
126
+ will not be cached and all files will be re-checked on each run.
127
+
128
+ To force a full re-check:
129
+
130
+ ```
131
+ pytest --cppcheck --cache-clear
132
+ ```
133
+
134
+ ## License
135
+
136
+ MIT
@@ -1,3 +1,4 @@
1
+ LICENSE
1
2
  README.md
2
3
  pyproject.toml
3
4
  src/pytest_cppcheck/__init__.py
@@ -1,10 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pytest-cppcheck
3
- Version: 0.1.0
4
- Summary: A pytest plugin that runs cppcheck static analysis on C/C++ source files
5
- Classifier: Framework :: Pytest
6
- Classifier: Programming Language :: Python :: 3
7
- Classifier: License :: OSI Approved :: MIT License
8
- Requires-Python: >=3.8
9
- Requires-Dist: pytest>=7.0
10
- Requires-Dist: cppcheck>=1.4.0
@@ -1,10 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pytest-cppcheck
3
- Version: 0.1.0
4
- Summary: A pytest plugin that runs cppcheck static analysis on C/C++ source files
5
- Classifier: Framework :: Pytest
6
- Classifier: Programming Language :: Python :: 3
7
- Classifier: License :: OSI Approved :: MIT License
8
- Requires-Python: >=3.8
9
- Requires-Dist: pytest>=7.0
10
- Requires-Dist: cppcheck>=1.4.0