logginghandler/vendor/github.com/phayes/checkstyle
Marvin Preuss d095180eb4
All checks were successful
continuous-integration/drone/push Build is passing
build: uses go modules for tool handling
2022-01-14 13:51:56 +01:00
..
.scrutinizer.yml build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
checkstyle.go build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
godoc.go build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
LICENSE build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
README.md build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00

checkstyle

GoDoc Go Report Card Build Status

Read and write checksyle_report.xml files with golang

Checkstyle XML files are a standard file format for reporting errors in source code, and is often generated by static analysis tools.

Example usage:


import "github.com/phayes/checkstyle"

// Print XML into human readable format
checkSyle, err := checkstyle.ReadFile("checkstyle_report.xml")
if err != nil {
  log.Fatal(err)
}
for _, file := range checkStyle.File {
  fmt.Println(File.Name)
  for _, codingError := range file.Error {
    fmt.Println("\t", codingError.Line, codingError.Message)
  }
}

// Create a new XML file from scratch
check := checkstyle.New()

// Ensure that a file has been added
file := check.EnsureFile("/path/to/file")

// Create an error on line 10
codingError := checkstyle.NewError(10, "format", "line must end with a full stop")

// Add the error to the file
file.AddError(codingError)

// Output XML
fmt.Print(check)

For more information on checkstyle XML see: http://checkstyle.sourceforge.net/checks.html