@codacy/tools-checkstyle-13 0.22.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 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,73 @@
1
+ # @codacy/tools-checkstyle-13
2
+
3
+ ## Table of Contents
4
+
5
+ - [Overview](#overview)
6
+ - [Updating patterns](#updating-patterns)
7
+ - [Updating the Checkstyle version](#updating-the-checkstyle-version)
8
+ - [Development](#development)
9
+ - [Notes for maintainers](#notes-for-maintainers)
10
+
11
+ ---
12
+
13
+ ## Overview
14
+
15
+ Java style checker and static analysis tool using the [Checkstyle](https://checkstyle.org) fat JAR. Uses the CLI execution strategy -- spawns `java -jar checkstyle-all.jar` via `spawnTool()` and parses its XML output.
16
+
17
+ | Property | Value |
18
+ | ------------- | -------------------------------------- |
19
+ | Tool ID | `Checkstyle` |
20
+ | Codacy UUID | `f4a54ce0-1fe1-4bc7-a9ed-9f91f675c409` |
21
+ | Strategy | CLI |
22
+ | Languages | Java |
23
+ | Binary | `java -jar checkstyle-13.9.0-all.jar` |
24
+ | File patterns | `**/*.java` |
25
+
26
+ ## Updating patterns
27
+
28
+ ```bash
29
+ # Re-fetch pattern metadata from the Codacy API
30
+ pnpm prefetch
31
+
32
+ # Commit the result
33
+ git add src/patterns.json
34
+ ```
35
+
36
+ Pattern IDs follow the format `Checkstyle_AvoidStarImport`, `Checkstyle_WhitespaceAround`, etc. The check name is extracted from the FQCN source attribute (e.g. `com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck` becomes `AvoidStarImport`).
37
+
38
+ ## Updating the Checkstyle version
39
+
40
+ 1. Update `CHECKSTYLE_VERSION` in `src/adapter.ts`
41
+ 2. Update `JAR_NAME` and `JAR_URL` constants accordingly
42
+ 3. Run `pnpm prefetch` to check for new/removed rules
43
+ 4. Run `pnpm test` to verify compatibility
44
+ 5. If the major version changes, create a new adapter package (`checkstyle-11/`)
45
+
46
+ ## Development
47
+
48
+ ```bash
49
+ pnpm build # Build with tsup
50
+ pnpm test # Run tests (requires java in PATH + JAR in tools dir)
51
+ ```
52
+
53
+ To install the Checkstyle JAR locally for testing:
54
+
55
+ ```bash
56
+ mkdir -p /tmp/codacy-checkstyle-test-tools
57
+ curl -L -o /tmp/codacy-checkstyle-test-tools/checkstyle-13.9.0-all.jar \
58
+ https://github.com/checkstyle/checkstyle/releases/download/checkstyle-13.9.0/checkstyle-13.9.0-all.jar
59
+ ```
60
+
61
+ ## Notes for maintainers
62
+
63
+ - Checkstyle requires Java 11+ as a runtime. The adapter uses `ensureJre()` to download Adoptium Temurin JDK 21 if no system Java is found.
64
+ - The fat JAR is downloaded from GitHub releases via `downloadJar()` to `~/.codacy/tools/checkstyle-13/`.
65
+ - Exit code 0 = no violations, >0 = violations found (parse XML), negative = error.
66
+ - XML output is on stdout (unlike cppcheck which uses stderr).
67
+ - `error/@source` is an FQCN like `com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck`. The adapter strips the package prefix and `Check` suffix to derive the check name.
68
+ - `error/@column` may be absent; defaults to 1 when missing.
69
+ - Line/column numbers in Checkstyle XML are already 1-based; no conversion needed.
70
+ - Some modules (Header, FileLength, LineLength, etc.) are global and must be placed under `<module name="Checker">` rather than inside `<module name="TreeWalker">`. The adapter handles this split when generating config from patterns.
71
+ - Config file detection looks for `checkstyle.xml` in the repository root.
72
+ - When no local config and no patterns are specified, the adapter uses Checkstyle's built-in `sun_checks.xml`.
73
+ - Checkstyle prints `Starting audit...` and `Audit done.` to stderr; these are filtered out from the error output.
@@ -0,0 +1,5 @@
1
+ import * as _codacy_tooling from '@codacy/tooling';
2
+
3
+ declare const _default: Readonly<_codacy_tooling.ToolAdapter>;
4
+
5
+ export { _default as default };