sonar

package
v2.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: Apache-2.0 Imports: 5 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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