output

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySuggestedFixes added in v0.10.0

func ApplySuggestedFixes(fixes map[string][]*Edit)

func Modify added in v0.8.0

func Modify(conf *config.Config, diag *Diagnostic)

func PrintAsConsole

func PrintAsConsole(diag *Diagnostic) (ret bool)

PrintAsConsole prinst the issues to console with colors and returns false in case only warning or info isues

func PrintAsGithub

func PrintAsGithub(diag *Diagnostic) (ret bool)

Types

type CachedFile

type CachedFile struct {
	Filename string
	Data     []byte
	Lines    []string
}

type Diagnostic

type Diagnostic map[string]map[string]*IssuesOrError

Diagnostic is a structure to hold the json output from multichecker

JSON example: ```json

{
 "<package>": {
   "<analyzer>": {
     "posn": "</path/to/file.go>:<line num>:<column num>",
     "message": "<message>",
     "suggested_fixes": [
       {
         "message": "",
         "edits": [
           {
             "filename": "</path/to/file.go>",
             "start": 865,
             "end": 865,
             "new": "<new text>"
           }
         ]
       }
     ]
   }
 }
}

```

func ParseOutput

func ParseOutput(conf *config.Config, data []byte) *Diagnostic

type Edit

type Edit struct {
	Filename string    `json:"filename"`
	New      string    `json:"new"`
	Start    token.Pos `json:"start"`
	End      token.Pos `json:"end,omitempty"`
}

type Fix

type Fix struct {
	Message string  `json:"message,omitempty"`
	Diff    string  `json:"-"` // system field to contain calculated diff
	Edits   []*Edit `json:"edits"`
}

type Issue

type Issue struct {
	Message        string `json:"message"`
	Category       string `json:"category,omitempty"`
	PosN           string `json:"posn"`
	SeverityLevel  string `json:"severity_level"`
	SuggestedFixes []*Fix `json:"suggested_fixes,omitempty"`
}

type IssuesOrError added in v0.9.0

type IssuesOrError struct {
	Error  string
	Issues []*Issue
}

func (*IssuesOrError) MarshalJSON added in v0.9.0

func (o *IssuesOrError) MarshalJSON() ([]byte, error)

func (*IssuesOrError) UnmarshalJSON added in v0.9.0

func (o *IssuesOrError) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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