spotbugs

package
v0.0.0-...-ebfb947 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractMessage

func ExtractMessage(bi BugInstance) string

ExtractMessage will try its best to find a message to associate with the Spotbugs violation.

Types

type BugInstance

type BugInstance struct {
	Abbreviation string `xml:"abbrev,attr"`
	Category     string `xml:"category,attr"`
	Priority     int    `xml:"priority,attr"`
	Type         string `xml:"type,attr"`
	ShortMessage string `xml:"ShortMessage"`
	LongMessage  string `xml:"LongMessage"`
	Class        struct {
		Name       string     `xml:"classname,attr"`
		SourceLine SourceLine `xml:"SourceLine"`
		Message    string     `xml:"message"`
	} `xml:"Class"`
	Method struct {
		Name       string     `xml:"name,attr"`
		ClassName  string     `xml:"classname,attr"`
		SourceLine SourceLine `xml:"SourceLine"`
		Message    string     `xml:"message"`
	} `xml:"Method"`
	Field struct {
		Name       string     `xml:"name,attr"`
		ClassName  string     `xml:"classname,attr"`
		SourceLine SourceLine `xml:"SourceLine"`
		Message    string     `xml:"message"`
	} `xml:"Field"`
	SourceLine []SourceLine `xml:"SourceLine"`
}

BugInstance entry

type SourceLine

type SourceLine struct {
	Classname  string `xml:"classname,attr"`
	Start      int    `xml:"start,attr"`
	End        int    `xml:"end,attr"`
	Sourcepath string `xml:"sourcepath,attr"`
	Sourcefile string `xml:"sourcefile,attr"`
	Message    string `xml:"Message"`
}

SourceLine entry

type Spotbugs

type Spotbugs struct {
	AnalysisTimestamp int64  `xml:"analysisTimestamp,attr"`
	Version           string `xml:"version,attr"`
	Timestamp         int64  `xml:"timestamp,attr"`
	Project           struct {
		Name string `xml:"projectName,attr"`
	} `xml:"Project"`
	BugInstance []BugInstance `xml:"BugInstance"`
	Errors      struct {
		MissingClasses int64 `xml:"missingClasses,attr"`
		Errors         int64 `xml:"errors,attr"`
	} `xml:"Errors"`
	FindBugsSummary struct {
		NumPackages int    `xml:"num_packages,attr"`
		TotalBugs   int    `xml:"total_bugs,attr"`
		Timestamp   string `xml:"timestamp,attr"`
		FileStats   []struct {
			Path     string `xml:"path,attr"`
			Size     int    `xml:"size,attr"`
			BugCount int    `xml:"bug_count,attr`
			BugHash  string `xml:"bugHash,attr"`
		} `xml:"FileStats"`
		PackageStats []struct {
			Name       string `xml:"package,attr"`
			TotalBugs  int    `xml:"total_bugs,attr"`
			TotalSize  int    `xml:"total_size,attr"`
			TotalTypes int    `xml:"total_types,attr"`
			ClassStats []struct {
				Name       string `xml:"class,attr"`
				Bugs       string `xml:"bugs,attr"`
				Size       string `xml:"size,attr"`
				Interface  string `xml:"interface,attr"`
				SourceFile string `xml:"sourceFile,attr"`
			} `xml:"ClassStats"`
		} `xml:"PackageStats"`
	} `xml:"FindBugsSummary"`
	ClassFeatures []struct{} `xml:"ClassFeatures"`
	History       []struct{} `xml:"History"`
}

The Spotbugs struct represents the spotbugs xml format

func Process

func Process(files []string) (bugs []*Spotbugs)

Process a list of file paths, loading them as Spotbugs structs.

Jump to

Keyboard shortcuts

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