analyzer

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnnotationReader = &analysis.Analyzer{
	Name: "annotationreader",
	Doc:  "Reads @implements, @immutable, @constructor, @packageonly annotations from code",
	Run:  runAnnotationReader,
	Requires: []*analysis.Analyzer{
		ConfigReader,
	},
	FactTypes: []analysis.Fact{
		(*annotations.AnnotationReaderFact)(nil),
	},
	ResultType: reflect.TypeOf(annotations.PackageAnnotations{}),
}

AnnotationReader reads annotations from code and exports them as facts

View Source
var ConfigReader = &analysis.Analyzer{
	Name:       "config",
	Doc:        "Reads configuration from environment variables and command line flags",
	Run:        runConfig,
	ResultType: reflect.TypeOf(config.Empty()),
	Flags:      *config.CreateFlagSet(),
}

ConfigReader reads configuration from environment variables and command line flags This analyzer must run first to provide configuration to other analyzers IMPORTANT: Name "config" is required for proper flag prefixing by multichecker Do not change the analyzer name as it affects command-line flag names

View Source
var ConstructorChecker = &analysis.Analyzer{
	Name: "constructorchecker",
	Doc:  "Checks that types with @constructor are only instantiated in declared constructors",
	Run:  runConstructorChecker,
	Requires: []*analysis.Analyzer{
		ConfigReader,
		AnnotationReader,
		IgnoreReader,
	},
	FactTypes: []analysis.Fact{
		(*annotations.ConstructorCheckerFact)(nil),
	},
}

ConstructorChecker checks @constructor annotations

View Source
var IgnoreReader = &analysis.Analyzer{
	Name: "ignorereader",
	Doc:  "Reads @ignore CODE1, CODE2 annotations from code",
	Run:  runIgnoreReader,
	Requires: []*analysis.Analyzer{
		ConfigReader,
	},
	ResultType: reflect.TypeOf(ignore.IgnoreResult{}),
}

IgnoreReader reads @ignore annotations from code

View Source
var ImmutableChecker = &analysis.Analyzer{
	Name: "immutabilitychecker",
	Doc:  "Checks that types marked as @immutable follow immutability rules",
	Run:  runImmutableChecker,
	Requires: []*analysis.Analyzer{
		ConfigReader,
		AnnotationReader,
		IgnoreReader,
	},
	FactTypes: []analysis.Fact{
		(*annotations.ImmutableCheckerFact)(nil),
	},
}

ImmutableChecker checks @immutable annotations

View Source
var ImplementsChecker = &analysis.Analyzer{
	Name: "implementschecker",
	Doc:  "Checks that types implement interfaces as declared by @implements",
	Run:  runImplementsChecker,
	Requires: []*analysis.Analyzer{
		ConfigReader,
		AnnotationReader,
		IgnoreReader,
	},
	FactTypes: []analysis.Fact{
		(*annotations.ImplementsCheckerFact)(nil),
	},
}

ImplementsChecker checks @implements annotations

View Source
var PackageOnlyChecker = &analysis.Analyzer{
	Name: "packageonlychecker",
	Doc:  "Checks that @packageonly items are only used in allowed packages",
	Run:  runPackageOnlyChecker,
	Requires: []*analysis.Analyzer{
		ConfigReader,
		AnnotationReader,
		IgnoreReader,
	},
	FactTypes: []analysis.Fact{
		(*annotations.PackageOnlyCheckerFact)(nil),
	},
}

PackageOnlyChecker checks @packageonly annotations

View Source
var TestOnlyChecker = &analysis.Analyzer{
	Name: "testonlychecker",
	Doc:  "Checks that @testonly items are only used in test files",
	Run:  runTestOnlyChecker,
	Requires: []*analysis.Analyzer{
		ConfigReader,
		AnnotationReader,
		IgnoreReader,
	},
	FactTypes: []analysis.Fact{
		(*annotations.TestOnlyCheckerFact)(nil),
	},
}

TestOnlyChecker checks @testonly annotations

Functions

func AllAnalyzers

func AllAnalyzers() []*analysis.Analyzer

AllAnalyzers returns all available analyzers

Types

This section is empty.

Jump to

Keyboard shortcuts

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