@codacy/tools-cppcheck-2 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3694 -0
- package/package.json +32 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Codacy
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @codacy/tools-cppcheck-2
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
- [Overview](#overview)
|
|
5
|
+
- [Updating patterns](#updating-patterns)
|
|
6
|
+
- [Updating the Cppcheck version](#updating-the-cppcheck-version)
|
|
7
|
+
- [Development](#development)
|
|
8
|
+
- [Notes for maintainers](#notes-for-maintainers)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
C/C++ static analyzer using the [Cppcheck](https://cppcheck.sourceforge.io/) binary. Uses the CLI execution strategy — spawns `cppcheck` via `spawnTool()` and parses its XML output.
|
|
15
|
+
|
|
16
|
+
| Property | Value |
|
|
17
|
+
|----------|-------|
|
|
18
|
+
| Tool ID | `cppcheck` |
|
|
19
|
+
| Codacy UUID | `02eb6a1c-757f-4324-81bf-094835a1578b` |
|
|
20
|
+
| Strategy | CLI |
|
|
21
|
+
| Languages | C, C++ |
|
|
22
|
+
| Binary | `cppcheck` |
|
|
23
|
+
| File patterns | `**/*.c`, `**/*.cpp`, `**/*.cc`, `**/*.cxx`, `**/*.h`, `**/*.hpp`, `**/*.hh` |
|
|
24
|
+
| Pattern count | ~420 |
|
|
25
|
+
| Extra dependency | `fast-xml-parser` (for XML output parsing) |
|
|
26
|
+
|
|
27
|
+
## Updating patterns
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Re-fetch pattern metadata from the Codacy API
|
|
31
|
+
pnpm prefetch
|
|
32
|
+
|
|
33
|
+
# Commit the result
|
|
34
|
+
git add src/patterns.json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Pattern IDs follow the format `cppcheck_nullPointer`, `cppcheck_unusedVariable`, etc.
|
|
38
|
+
|
|
39
|
+
## Updating the Cppcheck version
|
|
40
|
+
|
|
41
|
+
1. Update `preferredVersion` in `src/adapter.ts`
|
|
42
|
+
2. Run `pnpm prefetch` to check for new/removed rules
|
|
43
|
+
3. Run `pnpm test` to verify compatibility
|
|
44
|
+
4. If the major version changes, create a new adapter package (`cppcheck-3/`)
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pnpm build # Build with tsup
|
|
50
|
+
pnpm test # Run tests (requires cppcheck in PATH)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Cppcheck must be installed manually** — the adapter's `install()` returns `NotSupported`. Install via your system package manager:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# macOS
|
|
57
|
+
brew install cppcheck
|
|
58
|
+
|
|
59
|
+
# Ubuntu/Debian
|
|
60
|
+
apt-get install cppcheck
|
|
61
|
+
|
|
62
|
+
# Fedora
|
|
63
|
+
dnf install cppcheck
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Notes for maintainers
|
|
67
|
+
|
|
68
|
+
- Cppcheck outputs **XML to stderr** (not stdout). The adapter captures stderr and parses it with `fast-xml-parser`.
|
|
69
|
+
- The `--xml` flag enables XML output; `--enable=all` activates all checkers.
|
|
70
|
+
- `--error-exitcode=0` prevents non-zero exit codes on findings.
|
|
71
|
+
- `--inline-suppr` respects inline suppression comments.
|
|
72
|
+
- `--force` checks all configurations even if `#ifdef` branches are present.
|
|
73
|
+
- `unusedFunction` is suppressed via `--suppress=unusedFunction` (too noisy for single-file analysis).
|
|
74
|
+
- Automated installation is not supported — Cppcheck doesn't provide pre-built binaries for all platforms on GitHub releases.
|