analysis

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package analysis implements an Annotation type to return annotations on files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnnotationsToUserError

func AnnotationsToUserError(annotations []*Annotation, asJSON bool) error

AnnotationsToUserError converts the annotations to a user error.

If annotations is empty, this returns nil.

func PrintAnnotations

func PrintAnnotations(writer io.Writer, annotations []*Annotation, asJSON bool) error

PrintAnnotations prints the annotations to the Writer.

If asJSON is specified, the annotations are marshalled as JSON.

func SortAnnotations

func SortAnnotations(annotations []*Annotation)

SortAnnotations sorts the Annotations.

The order of sorting is:

Filename
StartLine
StartColumn
Type
Message
EndLine
EndColumn

Types

type Annotation

type Annotation struct {
	// Filename is the filename to display. This is typically a
	// relative path when produced by linters. If the filename
	// is not known, this will be empty.
	Filename string `json:"filename,omitempty" yaml:"filename,omitempty"`
	// StartLine is the starting line. If the line is not known,
	// this will be 0.
	StartLine int `json:"start_line,omitempty" yaml:"start_line,omitempty"`
	// StartColumn is the starting column. If the column is not
	// known, this will be 0.
	StartColumn int `json:"start_column,omitempty" yaml:"start_column,omitempty"`
	// EndLine is the ending line. If the line is not known,
	// this will be 0. This will be explicitly set to the
	// value of StartLine if the start and end line are the same.
	EndLine int `json:"end_line,omitempty" yaml:"end_line,omitempty"`
	// EndColumn is the ending column. If the column is not known,
	// this will be 0. This will be explicitly set to the
	// value of StartColumn if the start and end column are the same.
	EndColumn int `json:"end_column,omitempty" yaml:"end_column,omitempty"`
	// Type is the type of annotation, typically an ID representing
	// a lint failure type. This field is required.
	Type string `json:"type,omitempty" yaml:"type,omitempty"`
	// Message is the message of the annotation. This is required.
	Message string `json:"message,omitempty" yaml:"message,omitempty"`
}

Annotation is an annotation refencing a location within a file.

func (*Annotation) String

func (a *Annotation) String() string

String returns a basic string representation of a.

Directories

Path Synopsis
Package analysistesting implements testing functionality for Annotations.
Package analysistesting implements testing functionality for Annotations.

Jump to

Keyboard shortcuts

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