Skip to content

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 25 Sep 22:30
· 322 commits to main since this release
3d47ab4

Levenshtein 0.2.0 adds eight shared checks, a community lint rule system, and report formats for CI and code scanning. It also widens go-lint with more than 20 bug-finding analyzers. The full list of changes is in CHANGELOG.md.

Before you upgrade

  • Repositories without a levenshtein.json now run go-mod in their default branch, pre-merge, and main runs. An untidy root module, or one whose dependencies the container can't download (for example private modules reached only through vendor/), will start failing. Tidy the module, or add a levenshtein.json whose runs leave go-mod out.
  • go-lint reports more findings. The new analyzers listed below are on by default, so bumping your pin may surface findings in existing code. To adopt them gradually, record them in a baseline or turn individual rules off with "lint": {"checks": [...]}.
  • An analyzer that errors or panics now fails the check. Before, Staticcheck swallowed the error and cached a pass.

Highlights

Run the linter with only go

No checkout, container, or config needed:

go run github.com/wangjohn/levenshtein/runner/lint/cmd/levenshtein-lint@v0.2.0 ./...

Community lint rules

A top-level rule_modules object pins lint rules published as ordinary Go modules. They run beside the shipped rules in every Dagger go-lint check, report as <namespace>_<name>, work with //lint:ignore, and can be advisory. The community linter is built for the exact pins and runs with no credentials. See docs/community-rules.md.

Report formats, annotations, and SARIF

  • --format writes json (the default), text, github (Actions annotations), or sarif (SARIF 2.1.0 for code scanning). --render REPORT reformats a saved report without rerunning anything.
  • The GitHub Action annotates failing findings by default, can write a SARIF file, and lists failing findings, advisory findings, and warnings in the job summary.
  • Findings with a mechanical fix carry a one-line hint, such as gofmt -w <file>.

Findings baseline

An optional baseline file records existing findings by file, code, and message, never by line number. Recorded findings don't fail the run, new ones do, and an entry that no longer matches anything fails as baseline-stale until you delete it. Create one with --write-baseline, or report everything with --no-baseline.

Templates for coding agents and CI

templates/ includes a starter levenshtein.json, a GitHub Actions workflow with annotations and a code scanning upload, Claude Code hooks, and an AGENTS.md section. See docs/agents.md.

New shared checks

Each runs on both executors (Dagger and native). Only go-mod joins the default gates; add the others to your own runs.

Check What it does
go-mod go mod tidy -diff and go mod verify; fails on untidy manifests or hash mismatches
go-test go test -race ./...; separates test failures and races from build errors and all-skipped runs
go-imports Enforces package layering rules (deny / allow) declared in an imports object
go-generate Reruns go generate in a scratch copy and reports any file it would change
go-apidiff Fails a branch that breaks a library module's exported API relative to its base
workflow-security zizmor 1.30.1 offline audits of workflows, composite actions, and Dependabot config
shell-lint ShellCheck 0.11.0 over shell scripts, warnings and errors only
secrets gitleaks 8.30.1 over the target's files, with every value redacted before it's reported
deps-vuln osv-scanner 2.6.0 over non-Go lockfiles (npm, pnpm, yarn, Python, Cargo, Gemfile, and more)

Third-party tool downloads are pinned by SHA-256 per platform and verified before they run.

More go-lint analyzers

  • Bug patterns: unparam, musttag, recvcheck, contextcheck, nilnesserr, fatcontext, bidichk, gocheckcompilerdirectives, exptostd, usetesting, reflectvaluecompare, httpmux, gochecksumtype, scannererr, testableexamples
  • go-critic: the likely-bug (diagnostic) checkers plus filepathJoin, badRegexp, badSyncOnceFunc, evalOrder, rangeAppendAll, and returnAfterHttpError. Each reports under its own name, so you can ignore or deselect one at a time.
  • Logging: zerologlint and loggercheck
  • Opt-in (off by default): gocognit (cognitive complexity over 30) and deferInLoop. Turn them on per check with "lint": {"checks": [...]}.

docs/checks.md lists the analyzers that were measured and left out, and why.

Fixes

  • go-lint in packages that import "C" now judges each file by its original source. Upstream findings in hand-written cgo files were silently dropped before, and LV1005 no longer reports cgo's build-cache output as unformatted.
  • //lint:ignore nilerr <reason> now suppresses the finding instead of failing the check.
  • musttag no longer fails unnoticed on the test main that go test generates.
  • Cancelling verify now stops input discovery's git ls-files, and a failed listing is no longer reused for the rest of the run.

Verifying the release

Each archive has an SPDX SBOM, and checksums.txt covers every file. Check an archive's build provenance with:

gh attestation verify <file> --repo wangjohn/levenshtein