analysisflags

package
v0.0.0-...-d7df357 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package analysisflags defines helpers for processing flags of analysis driver tools.

Index

Constants

This section is empty.

Variables

View Source
var (
	JSON    = false // -json
	Context = -1    // -c=N: if N>0, display offending line plus N lines of context
)

flags common to all {single,multi,unit}checkers.

Functions

func Help

func Help(progname string, analyzers []*analysis.Analyzer, args []string)

Help implements the help subcommand for a multichecker or unitchecker style command. The optional args specify the analyzers to describe. Help calls log.Fatal if no such analyzer exists.

func Parse

func Parse(analyzers []*analysis.Analyzer, multi bool) []*analysis.Analyzer

Parse creates a flag for each of the analyzer's flags, including (in multi mode) a flag named after the analyzer, parses the flags, then filters and returns the list of analyzers enabled by flags.

func PrintPlain

func PrintPlain(fset *token.FileSet, diag analysis.Diagnostic)

PrintPlain prints a diagnostic in plain text form, with context specified by the -c flag.

Types

type JSONTree

type JSONTree map[string]map[string]interface{}

A JSONTree is a mapping from package ID to analysis name to result. Each result is either a jsonError or a list of jsonDiagnostic.

func (JSONTree) Add

func (tree JSONTree) Add(fset *token.FileSet, id, name string, diags []analysis.Diagnostic, err error)

Add adds the result of analysis 'name' on package 'id'. The result is either a list of diagnostics or an error.

func (JSONTree) Print

func (tree JSONTree) Print()

Jump to

Keyboard shortcuts

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