Documentation ¶
Overview ¶
Package analyses defines the internal representation of static analysis reports.
Index ¶
Constants ¶
const ( // Ref defines the git-notes ref that we expect to contain analysis reports. Ref = "refs/notes/devtools/analyses" // StatusLooksGoodToMe is the status string representing that analyses reported no messages. StatusLooksGoodToMe = "lgtm" // StatusForYourInformation is the status string representing that analyses reported informational messages. StatusForYourInformation = "fyi" // StatusNeedsMoreWork is the status string representing that analyses reported error messages. StatusNeedsMoreWork = "nmw" // FormatVersion defines the latest version of the request format supported by the tool. FormatVersion = 0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalyzeResponse ¶
type AnalyzeResponse struct {
Notes []Note `json:"note,omitempty"`
}
AnalyzeResponse represents the response from a static-analysis tool.
type Location ¶
type Location struct { Path string `json:"path,omitempty"` Range *LocationRange `json:"range,omitempty"` }
Location represents the location within a source tree that an analysis message covers.
type LocationRange ¶
type LocationRange struct { StartLine uint32 `json:"start_line,omitempty"` StartColumn uint32 `json:"start_column,omitempty"` EndLine uint32 `json:"end_line,omitempty"` EndColumn uint32 `json:"end_column,omitempty"` }
LocationRange represents the location within a source file that an analysis message covers.
type Note ¶
type Note struct { Location *Location `json:"location,omitempty"` Category string `json:"category,omitempty"` Description string `json:"description"` }
Note represents a single analysis message.
type Report ¶
type Report struct { Timestamp string `json:"timestamp,omitempty"` URL string `json:"url,omitempty"` Status string `json:"status,omitempty"` // Version represents the version of the metadata format. Version int `json:"v,omitempty"` }
Report represents a build/test status report generated by analyses tool. Every field is optional.
func GetLatestAnalysesReport ¶
GetLatestAnalysesReport takes a collection of analysis reports, and returns the one with the most recent timestamp.
func Parse ¶
func Parse(note repository.Note) (Report, error)
Parse parses an analysis report from a git note.
func ParseAllValid ¶
func ParseAllValid(notes []repository.Note) []Report
ParseAllValid takes collection of git notes and tries to parse a analyses report from each one. Any notes that are not valid analyses reports get ignored.
func (Report) GetLintReportResult ¶
func (analysesReport Report) GetLintReportResult() ([]AnalyzeResponse, error)
GetLintReportResult downloads the details of a lint report and returns the responses embedded in it.
type ReportDetails ¶
type ReportDetails struct {
AnalyzeResponse []AnalyzeResponse `json:"analyze_response,omitempty"`
}
ReportDetails represents an entire static analysis run (which might include multiple analysis tools).