@codacy/tools-revive-1 0.3.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 +70 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1300 -0
- package/package.json +31 -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,70 @@
|
|
|
1
|
+
# @codacy/tools-revive-1
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
- [Overview](#overview)
|
|
6
|
+
- [Updating patterns](#updating-patterns)
|
|
7
|
+
- [Updating the Revive version](#updating-the-revive-version)
|
|
8
|
+
- [Development](#development)
|
|
9
|
+
- [Notes for maintainers](#notes-for-maintainers)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Go linter using the [Revive](https://github.com/mgechev/revive) binary. Uses the CLI execution strategy — spawns `revive` via `spawnTool()` and parses its JSON output. Revive is a fast, configurable, extensible linter for Go that provides a framework for development of custom rules.
|
|
16
|
+
|
|
17
|
+
| Property | Value |
|
|
18
|
+
| ------------- | -------------------------------------- |
|
|
19
|
+
| Tool ID | `Revive` |
|
|
20
|
+
| Codacy UUID | `bd81d1f4-1406-402d-9181-1274ee09f1aa` |
|
|
21
|
+
| Strategy | CLI |
|
|
22
|
+
| Languages | Go |
|
|
23
|
+
| Binary | `revive` |
|
|
24
|
+
| File patterns | `**/*.go` |
|
|
25
|
+
| Pattern count | 96 |
|
|
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 `Revive_exported`, `Revive_blank-imports`, `Revive_cyclomatic`, etc. The `Revive_` prefix matches the Codacy API prefix exactly.
|
|
38
|
+
|
|
39
|
+
## Updating the Revive version
|
|
40
|
+
|
|
41
|
+
1. Update `preferredVersion` in `src/adapter.ts`
|
|
42
|
+
2. Update the download URL template if the release asset naming changed
|
|
43
|
+
3. Run `pnpm prefetch` to check for new/removed rules
|
|
44
|
+
4. Run `pnpm test` to verify compatibility
|
|
45
|
+
5. If the major version changes, create a new adapter package (`revive-2/`)
|
|
46
|
+
|
|
47
|
+
## Development
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pnpm build # Build with tsup
|
|
51
|
+
pnpm test # Run tests (mocked tests always run; integration tests require revive in PATH)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
To install revive locally for integration tests:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
go install github.com/mgechev/revive@v1.12.0
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Notes for maintainers
|
|
61
|
+
|
|
62
|
+
- Revive is distributed as a pre-built binary from GitHub releases (tar.gz archive per platform).
|
|
63
|
+
- The binary is downloaded via `downloadAndExtract()` since it comes as a tar.gz.
|
|
64
|
+
- Go runtime is an optional dependency needed for type-checked rules. The adapter downloads Go via `ensureGo()` during `install()` and uses `buildGoEnv()` / `goModDownload()` during `analyze()`.
|
|
65
|
+
- JSON output via `-formatter json`.
|
|
66
|
+
- Exit code 0 means no issues, exit code 1 means issues were found (normal), exit code 2+ means a genuine error.
|
|
67
|
+
- Config generation writes TOML syntax (`[rule.{name}]` sections) to `.codacy/generated/revive.toml`.
|
|
68
|
+
- Pattern parameters are emitted as `arguments = [value]` in the generated TOML.
|
|
69
|
+
- The `confidence = 0.0` setting in generated configs ensures all findings are reported regardless of confidence level.
|
|
70
|
+
- Platform mapping: `darwin-arm64` -> `darwin_arm64`, `darwin-x64` -> `darwin_amd64`, `linux-x64` -> `linux_amd64`, `linux-arm64` -> `linux_arm64`.
|