yze

package module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 30 Imported by: 0

README

yze

The aggregator for the gomatic yze analyzer family: it fans in every yze-<name> analyzer and runs them over Go packages through the go-yze driver, emitting a normalized report. Each analyzer reports under the rule id yze/<name>.

yze [--format stickler-json|text] [--fix] [--category <c>...] [--config <path>] [packages...]
  • --format stickler-json (default) — the native Report JSON the stickler runner consumes with no adapter. text prints one human line per finding.
  • --fix — applies analyzers' suggested fixes in place via the shared go-yze engine.
  • --category — restricts the analyzer set to those carrying any of the named categories (the many-to-many tag axis). Omit it to run the whole suite.
  • --config — path to a yze config file supplying per-analyzer settings.

Findings do not by themselves fail the run — that gate belongs to stickler. The current suite (14 analyzers): yze/anonstruct, yze/boolname, yze/ctxfirst, yze/emptyiface, yze/errconst, yze/errlast, yze/gotostmt, yze/layout, yze/namedtypes, yze/pkgstd, yze/ptrparam, yze/ptrrecv, yze/stdlog, yze/testfile.

Documentation

Overview

Package yze is the analyzer catalog for the yze family: it aggregates every yze-<name> analyzer's registration and filters the set by category. The cmd/yze binary drives this catalog through the go-yze runner.

Index

Constants

View Source
const ErrConfig errs.Const = "cannot load yze config"

ErrConfig reports a yze configuration file that cannot be read or parsed.

View Source
const ErrUnknownFormat errs.Const = "unknown output format"

ErrUnknownFormat reports an output format the aggregator does not support.

View Source
const ErrUnknownRuleFormat errs.Const = "unknown rule-export format"

ErrUnknownRuleFormat reports a rule-export format the aggregator does not support.

Variables

This section is empty.

Functions

func Emit

func Emit(w io.Writer, format Format, report goyze.Report) error

Emit writes the report to w in the named format.

func EmitRules added in v0.8.0

func EmitRules(w io.Writer, format RuleFormat, regs []goyze.Registration) error

EmitRules writes the suite's rule catalog to w in the named format.

func Filter

func Filter(regs []goyze.Registration, categories []goyze.Category) []goyze.Registration

Filter selects the registrations matching the given categories. An empty category set matches every analyzer; otherwise a registration matches when it carries any of the categories.

func LoadConfig added in v0.2.0

func LoadConfig(read func(path string) ([]byte, error), path string) (goyze.Settings, error)

LoadConfig reads and parses a yze config file into per-analyzer settings keyed by analyzer name then setting name, ready for go-yze's ApplyConfig. The reader is injected so callers control filesystem access.

func Registrations

func Registrations() []goyze.Registration

Registrations returns every analyzer in the suite, in stable rule-id order.

Types

type Format

type Format string

Format names a way the aggregator serializes a report.

const (
	FormatSticklerJSON Format = "stickler-json"
	FormatText         Format = "text"
)

The output formats cmd/yze supports. Richer formats (sarif, github) live in the stickler runner, which consumes the stickler-json emitted here.

type RuleFormat added in v0.8.0

type RuleFormat string

RuleFormat names a way the suite's rule catalog is exported. The catalog is built from registration metadata (id, name, doc, url, categories) — never from analyzer logic — so it carries no per-analyzer machinery.

const (
	// RuleFormatSARIF exports a SARIF 2.1.0 tool.driver.rules catalog for code
	// scanning / editor rule registration.
	RuleFormatSARIF RuleFormat = "sarif"
	// RuleFormatGrit exports a GritQL-style markdown registry. The analyzers are
	// AST-based, not pattern rewrites, so this is a documentation catalog (rule id,
	// description, docs link, categories) — not executable rewrite patterns.
	RuleFormatGrit RuleFormat = "grit"
)

The rule-export formats `yze --emit-rules` supports.

Directories

Path Synopsis
cmd
yze command
Command yze runs the gomatic yze analyzer suite over the given package patterns and emits a normalized report (the stickler-json contract by default).
Command yze runs the gomatic yze analyzer suite over the given package patterns and emits a normalized report (the stickler-json contract by default).

Jump to

Keyboard shortcuts

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