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

package bufanalysis

import "github.com/bufbuild/buf/internal/buf/bufanalysis"

Index

Package Files

bufanalysis.go file_annotation.go

Variables

var (
    // AllFormatStrings is all format strings without aliases.
    //
    // Sorted in the order we want to display them.
    AllFormatStrings = []string{
        "text",
        "json",
        "msvs",
    }
    // AllFormatStringsWithAliases is all format strings with aliases.
    //
    // Sorted in the order we want to display them.
    AllFormatStringsWithAliases = []string{
        "text",
        "gcc",
        "json",
        "msvs",
    }
)

func FormatFileAnnotation Uses

func FormatFileAnnotation(fileAnnotation FileAnnotation, format Format) (string, error)

FormatFileAnnotation formats the FileAnnotation.

func PrintFileAnnotations Uses

func PrintFileAnnotations(writer io.Writer, fileAnnotations []FileAnnotation, formatString string) error

PrintFileAnnotations prints the file annotations separated by newlines.

func SortFileAnnotations Uses

func SortFileAnnotations(fileAnnotations []FileAnnotation)

SortFileAnnotations sorts the FileAnnotations.

The order of sorting is:

ExternalPath
StartLine
StartColumn
Type
Message
EndLine
EndColumn

type FileAnnotation Uses

type FileAnnotation interface {
    // Stringer returns the string representation in text format.
    fmt.Stringer
    // Marshaler returns the string representation in JSON foramt.
    json.Marshaler
    // MSVSString returns the string representation in MSVS format.
    //
    // https://docs.microsoft.com/en-us/cpp/build/formatting-the-output-of-a-custom-build-step-or-build-event?view=vs-2019
    MSVSString() string

    // FileInfo is the FileInfo for this annotation.
    //
    // This may be nil.
    FileInfo() FileInfo

    // StartLine is the starting line.
    //
    // If the starting line is not known, this will be 0.
    StartLine() int
    // StartColumn is the starting column.
    //
    // If the starting column is not known, this will be 0.
    StartColumn() int
    // EndLine is the ending line.
    //
    // If the ending line is not known, this will be 0.
    // If the ending line is the same as the starting line, this will be explicitly
    // set to the same value as start_line.
    EndLine() int
    // EndColumn is the ending column.
    //
    // If the ending column is not known, this will be 0.
    // If the ending column is the same as the starting column, this will be explicitly
    // set to the same value as start_column.
    EndColumn() int
    // Type is the type of annotation, typically an ID representing a failure type.
    Type() string
    // Message is the message of the annotation.
    Message() string
}

FileAnnotation is a file annotation.

func NewFileAnnotation Uses

func NewFileAnnotation(
    fileInfo FileInfo,
    startLine int,
    startColumn int,
    endLine int,
    endColumn int,
    typeString string,
    message string,
) FileAnnotation

NewFileAnnotation returns a new FileAnnotation.

type FileInfo Uses

type FileInfo interface {
    Path() string
    ExternalPath() string
}

FileInfo is a minimal FileInfo interface.

type Format Uses

type Format int

Format is a FileAnnotation format.

const (
    // FormatText is the text format for FileAnnotations.
    FormatText Format = iota + 1
    // FormatJSON is the JSON format for FileAnnotations.
    FormatJSON
    // FormatMSVS is the MSVS format for FileAnnotations.
    FormatMSVS
)

func ParseFormat Uses

func ParseFormat(s string) (Format, error)

ParseFormat parses the Format.

The empty strings defaults to FormatText.

func (Format) String Uses

func (f Format) String() string

String implements fmt.Stringer.

Directories

PathSynopsis
bufanalysistesting

Package bufanalysis imports 7 packages (graph) and is imported by 10 packages. Updated 2020-10-20. Refresh now. Tools for package owners.