antislop

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 3 Imported by: 0

README

anti-slop-go

Opinionated go/analysis rules that reject low-evidence Go patterns.

This project is a Go companion to dmmulroy/anti-slop. The upstream project targets TypeScript and JavaScript through Oxlint. This project applies the same philosophy to Go.

Status

Implementation phase. The first analyzer, nountypedmap (rule G02), is available. Read the specification in docs/spec:

  1. Overview: philosophy, goals, and scope.
  2. Rules: the rule catalogue with examples.
  3. Implementation: architecture, distribution, and configuration.

The idea in one paragraph

Code generators produce code that compiles but carries no evidence. A type assertion with no stated invariant, an any parameter, or a map[string]any field moves a proof obligation from the author to the reader. These rules reject such patterns. The author must decode input at its I/O boundary, keep concrete types inside the program, and write a // SAFETY: justification where an assertion is the correct tool.

Development

Run make setup once per clone; it installs the tracked git hooks. make check is the definition of green: tidy check, vet, lint, the coverage-gate self-test, race-enabled tests behind a statement coverage gate (COVERAGE_MIN, default 90%), and the build. Read AGENTS.md before your first commit and REVIEW.md before your first pull request.

License

MIT. See LICENSE.

Documentation

Overview

Package antislop provides go/analysis analyzers that reject low-evidence Go patterns. The rule catalogue lives in docs/spec.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Analyzers

func Analyzers() []*analysis.Analyzer

Analyzers returns every analyzer this module provides. Consumers register the full list; rule toggles happen in the consumer's configuration, not here.

Types

This section is empty.

Directories

Path Synopsis
analyzers
nountypedmap
Package nountypedmap implements rule G02 of the anti-slop rule set.
Package nountypedmap implements rule G02 of the anti-slop rule set.
safetyassert
Package safetyassert implements rule G01 of the anti-slop rule set: a single-result type assertion must carry a SAFETY comment that states the invariant which makes the panic unreachable.
Package safetyassert implements rule G01 of the anti-slop rule set: a single-result type assertion must carry a SAFETY comment that states the invariant which makes the panic unreachable.
cmd
antislop command
Command antislop runs every anti-slop analyzer as a standalone multichecker.
Command antislop runs every anti-slop analyzer as a standalone multichecker.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL