buf: github.com/bufbuild/buf/internal/pkg/analysis Index | Files | Directories

package analysis

import "github.com/bufbuild/buf/internal/pkg/analysis"

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

Index

Package Files

analysis.go

func PrintAnnotations Uses

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 Uses

func SortAnnotations(annotations []*Annotation)

SortAnnotations sorts the Annotations.

The order of sorting is:

Filename
StartLine
StartColumn
Type
Message
EndLine
EndColumn

type Annotation Uses

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 Uses

func (a *Annotation) String() string

String returns a basic string representation of a.

Directories

PathSynopsis
analysistestingPackage analysistesting implements testing functionality for Annotations.

Package analysis imports 6 packages (graph) and is imported by 1 packages. Updated 2019-11-16. Refresh now. Tools for package owners.