Documentation
¶
Overview ¶
Package pmd is the PMD static analysis tool's implementation of an Impendulo tool. For more information see http://pmd.sourceforge.net/.
Index ¶
- Constants
- func RuleSet() (map[string]*Rule, error)
- type File
- type Report
- type Result
- func (r *Result) ChartVals() []*result.ChartVal
- func (r *Result) GetFileId() bson.ObjectId
- func (r *Result) GetId() bson.ObjectId
- func (r *Result) GetName() string
- func (this *Result) GetTestId() bson.ObjectId
- func (r *Result) GetType() string
- func (r *Result) Lines() []*result.Line
- func (r *Result) OnGridFS() bool
- func (r *Result) Reporter() result.Reporter
- func (r *Result) SetReport(report result.Reporter)
- func (r *Result) Success() bool
- func (r *Result) Template() string
- type Rule
- type Rules
- type Tool
- type Violation
- type Violations
Constants ¶
const (
NAME = "PMD"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
type File struct { Name string `xml:"name,attr"` Violations Violations `xml:"violation"` }
File defines a source file analysed by PMD and all of the errors found in it.
func (*File) CompressViolations ¶
func (f *File) CompressViolations()
CompressViolations packs all Violations of the same type into a single Violation by storing their location seperately.
type Report ¶
type Report struct { Id bson.ObjectId Version string `xml:"version,attr"` Files []*File `xml:"file"` Errors int }
Report is the result of running PMD on a Java source file.
type Result ¶
type Result struct { Id bson.ObjectId `bson:"_id"` FileId bson.ObjectId `bson:"fileid"` Name string `bson:"name"` Report *Report `bson:"report"` GridFS bool `bson:"gridfs"` Type string `bson:"type"` }
func NewResult ¶
NewResult creates a new PMD Result. Any error returned will be as a result of creating a PMD Report from the XML in data.
type Rule ¶
Rule is the descriptive representation of a PMD rule. It is used when a PMD configuration is chosen.
type Rules ¶
type Rules struct { Id bson.ObjectId `bson:"_id"` ProjectId bson.ObjectId `bson:"projectid"` Rules map[string]bool `bson:"rules"` }
Rules specifies the PMD rules configured for a specific project. It only stores each rule's identifier.
func DefaultRules ¶
DefaultRules creates a default Rules struct from the available rules.
func NewRules ¶
NewRules creates a bew Rules struct from a set of rules for a given project. Each rule in the set is checked against the available rules.
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool is an implementation of tool.T which allows us to run PMD on Java classes.
type Violation ¶
type Violation struct { Id bson.ObjectId Begin int `xml:"beginline,attr"` End int `xml:"endline,attr"` Rule string `xml:"rule,attr"` RuleSet string `xml:"ruleset,attr"` Url template.URL `xml:"externalInfoUrl,attr"` Priority int `xml:"priority,attr"` Description string `xml:",innerxml"` //The locations where the error was detected. Starts, Ends []int }
Violation describes an error detected by PMD.
type Violations ¶
type Violations []*Violation
Violations
func (Violations) Len ¶
func (v Violations) Len() int
func (Violations) Less ¶
func (v Violations) Less(i, j int) bool
func (Violations) Swap ¶
func (v Violations) Swap(i, j int)