checkstyle

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: MIT Imports: 4 Imported by: 0

README

checkstyle / chksutil

CI GoDoc Go Report Card

checkstyle is a library for working with checkstyle files.

The included chksutil is a utility for inspecting and diffing checkstyle files.

$ chksutil diff old.chk new.chk
Fixed info on GoalSetting.php:44 - DocblockTypeContradiction: Cannot resolve types for $value - docblock-defined type int does not contain null
Fixed info on GoalSetting.php:44 - RedundantConditionGivenDocblockType: Found a redundant condition when evaluating docblock-defined type $value and trying to reconcile type 'int' to !null
Created info on GoalSetting.php:72 - MissingParamType: Parameter $value has no provided 

Install chksutil

binaries are attached to the releases

https://github.com/methodci/checkstyle/releases

otherwise you can install from source via

$ go install github.com/methodci/checkstyle/cmd/chksutil@latest

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(left, right *Checkstyle, opt DiffOptions) (*Checkstyle, *Checkstyle)

Diff runs a diff operation on two checkstyle structs and returns two new checkstyle structs of fixed and created errors

Types

type Checkstyle

type Checkstyle struct {
	XMLName xml.Name `xml:"checkstyle"`
	Version string   `xml:"version,attr"`
	File    Files    `xml:"file"`
}

Checkstyle <checkstyle /> XML struct as defined by the checkstyle standard

func Decode

func Decode(r io.Reader) (*Checkstyle, error)

Decode reads a checkstyle file from a reader

type DiffOptions

type DiffOptions struct {
	MaxLineDiff int
}

DiffOptions are the options for the Diff command

type File added in v0.3.0

type File struct {
	Name  string      `xml:"name,attr"`
	Error []FileError `xml:"error"`
}

File <file /> XML struct as defined by the checkstyle standard

type FileError added in v0.3.0

type FileError struct {
	Line     int           `xml:"line,attr"`
	Severity SeverityLevel `xml:"severity,attr"`
	Message  string        `xml:"message,attr"`
	Source   string        `xml:"source,attr"`
}

FileError <error /> XML struct as defined by the checkstyle standard

type Files added in v0.3.0

type Files []File

Files is a collection of <file /> XML structs with added helpers

func (Files) FromName added in v0.3.0

func (chk Files) FromName(name string) File

FromName finds a File matching the given filename. If multiple files match a given name their errors will be merged

type SeverityLevel

type SeverityLevel string

SeverityLevel as defined by severity levels from https://checkstyle.sourceforge.io/property_types.html#SeverityLevel

const (
	SeverityIgnore  SeverityLevel = "ignore"
	SeverityInfo    SeverityLevel = "info"
	SeverityWarning SeverityLevel = "warning"
	SeverityError   SeverityLevel = "error"
)

SeverityLevels as defined by the checkstyle standard

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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