@codacy/tools-revive-1
v0.3.5
Published
Revive adapter — CLI-mode Go linter
Readme
@codacy/tools-revive-1
Table of Contents
Overview
Go linter using the 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.
| Property | Value |
| ------------- | -------------------------------------- |
| Tool ID | Revive |
| Codacy UUID | bd81d1f4-1406-402d-9181-1274ee09f1aa |
| Strategy | CLI |
| Languages | Go |
| Binary | revive |
| File patterns | **/*.go |
| Pattern count | 96 |
Updating patterns
# Re-fetch pattern metadata from the Codacy API
pnpm prefetch
# Commit the result
git add src/patterns.jsonPattern IDs follow the format Revive_exported, Revive_blank-imports, Revive_cyclomatic, etc. The Revive_ prefix matches the Codacy API prefix exactly.
Updating the Revive version
- Update
preferredVersioninsrc/adapter.ts - Update the download URL template if the release asset naming changed
- Run
pnpm prefetchto check for new/removed rules - Run
pnpm testto verify compatibility - If the major version changes, create a new adapter package (
revive-2/)
Development
pnpm build # Build with tsup
pnpm test # Run tests (mocked tests always run; integration tests require revive in PATH)To install revive locally for integration tests:
go install github.com/mgechev/[email protected]Notes for maintainers
- Revive is distributed as a pre-built binary from GitHub releases (tar.gz archive per platform).
- The binary is downloaded via
downloadAndExtract()since it comes as a tar.gz. - Go runtime is an optional dependency needed for type-checked rules. The adapter downloads Go via
ensureGo()duringinstall()and usesbuildGoEnv()/goModDownload()duringanalyze(). - JSON output via
-formatter json. - Exit code 0 means no issues, exit code 1 means issues were found (normal), exit code 2+ means a genuine error.
- Config generation writes TOML syntax (
[rule.{name}]sections) to.codacy/generated/revive.toml. - Pattern parameters are emitted as
arguments = [value]in the generated TOML. - The
confidence = 0.0setting in generated configs ensures all findings are reported regardless of confidence level. - Platform mapping:
darwin-arm64->darwin_arm64,darwin-x64->darwin_amd64,linux-x64->linux_amd64,linux-arm64->linux_arm64.
