checkstyle

package
v0.0.0-...-d4285bb Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2014 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package checkstyle is the Checkstyle static analysis tool's implementation of an Impendulo tool. See http://checkstyle.sourceforge.net/ for more information.

Index

Constants

View Source
const (
	NAME = "Checkstyle"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Id       bson.ObjectId
	Line     int           `xml:"line,attr"`
	Column   int           `xml:"column,attr"`
	Severity string        `xml:"severity,attr"`
	Message  template.HTML `xml:"message,attr"`
	Source   string        `xml:"source,attr"`
	Lines    []int
}

Error represents an occurrence of an error detected by checkstyle. It gives the location of the error, its severity and a thorough description.

func (*Error) String

func (e *Error) String() string

String

type Errors

type Errors []*Error

Errors

func (Errors) Len

func (e Errors) Len() int

func (Errors) Less

func (e Errors) Less(i, j int) bool

func (Errors) Swap

func (e Errors) Swap(i, j int)

type File

type File struct {
	Name   string `xml:"name,attr"`
	Errors Errors `xml:"error"`
}

File represents a file on which checkstyle was run and all errors found in it.

func (*File) CompressErrors

func (f *File) CompressErrors()

CompressErrors packs all Errors of the same type into a single Error by storing their location seperately.

func (*File) String

func (f *File) String() string

String

type Report

type Report struct {
	Id      bson.ObjectId
	Version string `xml:"version,attr"`
	Errors  int
	Files   []*File `xml:"file"`
}

Report represents the result of running Checkstyle on a Java source file.

func NewReport

func NewReport(id bson.ObjectId, data []byte) (res *Report, err error)

NewReport

func (*Report) File

func (r *Report) File(name string) *File

File

func (*Report) Lines

func (r *Report) Lines() []*result.Line

func (*Report) String

func (r *Report) String() string

String

func (*Report) Success

func (r *Report) Success() bool

Success

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

func NewResult(fileId bson.ObjectId, data []byte) (*Result, error)

NewResult creates a new Checkstyle Result. Any errors returned will be XML errors due to extracting a Report from data.

func (*Result) ChartVals

func (r *Result) ChartVals() []*result.ChartVal

ChartVals

func (*Result) GetFileId

func (r *Result) GetFileId() bson.ObjectId

GetFileId

func (*Result) GetId

func (r *Result) GetId() bson.ObjectId

GetId

func (*Result) GetName

func (r *Result) GetName() string

GetName

func (*Result) GetTestId

func (r *Result) GetTestId() bson.ObjectId

func (*Result) GetType

func (this *Result) GetType() string

func (*Result) Lines

func (r *Result) Lines() []*result.Line

func (*Result) OnGridFS

func (this *Result) OnGridFS() bool

OnGridFS

func (*Result) Reporter

func (r *Result) Reporter() result.Reporter

func (*Result) SetReport

func (r *Result) SetReport(report result.Reporter)

SetReport is used to change this result's report. This comes in handy when putting data into/getting data out of GridFS

func (*Result) String

func (this *Result) String() string

String

func (*Result) Template

func (r *Result) Template() string

type Tool

type Tool struct {
	// contains filtered or unexported fields
}

Tool is an implementation of tool.Tool which allows us to run Checkstyle on a Java class.

func New

func New() (tool *Tool, err error)

New creates a new instance of the checkstyle Tool. Any errors returned will of type config.ConfigError.

func (*Tool) Lang

func (this *Tool) Lang() tool.Language

Lang is Java

func (*Tool) Name

func (this *Tool) Name() string

Name is Checkstyle

func (*Tool) Run

func (t *Tool) Run(fileId bson.ObjectId, target *tool.Target) (result.Tooler, error)

Run runs checkstyle on the provided Java file. We make use of the configured Checkstyle configuration file. Output is written to an xml file which is then read in and used to create a Checkstyle Result.

Jump to

Keyboard shortcuts

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