sonar

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// EffortMinutes effort to fix in minutes
	EffortMinutes = 5
)

Variables

This section is empty.

Functions

func WriteReport

func WriteReport(w io.Writer, data *gosec.ReportInfo, rootPaths []string) error

WriteReport write a report in sonar format to the output writer

Types

type Issue

type Issue struct {
	EngineID           string      `json:"engineId"`
	RuleID             string      `json:"ruleId"`
	PrimaryLocation    *Location   `json:"primaryLocation"`
	Type               string      `json:"type"`
	Severity           string      `json:"severity"`
	EffortMinutes      int         `json:"effortMinutes"`
	SecondaryLocations []*Location `json:"secondaryLocations,omitempty"`
}

Issue defines a sonar issue

func NewIssue

func NewIssue(engineID string, ruleID string, primaryLocation *Location, issueType string, severity string, effortMinutes int) *Issue

NewIssue instantiate an Issue

type Location

type Location struct {
	Message   string     `json:"message"`
	FilePath  string     `json:"filePath"`
	TextRange *TextRange `json:"textRange,omitempty"`
}

Location defines a sonar issue's location

func NewLocation

func NewLocation(message string, filePath string, textRange *TextRange) *Location

NewLocation instantiate a Location

type Report

type Report struct {
	Issues []*Issue `json:"issues"`
}

Report defines a sonar report

func GenerateReport

func GenerateReport(rootPaths []string, data *gosec.ReportInfo) (*Report, error)

GenerateReport Convert a gosec report to a Sonar Report

type TextRange

type TextRange struct {
	StartLine   int `json:"startLine"`
	EndLine     int `json:"endLine"`
	StartColumn int `json:"startColumn,omitempty"`
	EtartColumn int `json:"endColumn,omitempty"`
}

TextRange defines the text range of an issue's location

func NewTextRange

func NewTextRange(startLine int, endLine int) *TextRange

NewTextRange instantiate a TextRange

Jump to

Keyboard shortcuts

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