aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/phayes
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-09-15 18:05:35 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-09-15 19:34:30 +0200
commit712de1c63d9db97c81af68cd0dc4372c53d2e57a (patch)
treeae1761fec52c3ae4ddd003a4130ddbda8d0a2d69 /vendor/github.com/phayes
parent298a69c38dd5c8a9bbd7a022e88f4ddbcf885e16 (diff)
vendor/github.com/golangci/golangci-lint: update to v1.31
Diffstat (limited to 'vendor/github.com/phayes')
-rw-r--r--vendor/github.com/phayes/checkstyle/.scrutinizer.yml15
-rw-r--r--vendor/github.com/phayes/checkstyle/LICENSE29
-rw-r--r--vendor/github.com/phayes/checkstyle/README.md44
-rw-r--r--vendor/github.com/phayes/checkstyle/checkstyle.go112
-rw-r--r--vendor/github.com/phayes/checkstyle/godoc.go36
5 files changed, 236 insertions, 0 deletions
diff --git a/vendor/github.com/phayes/checkstyle/.scrutinizer.yml b/vendor/github.com/phayes/checkstyle/.scrutinizer.yml
new file mode 100644
index 000000000..d9284b6b4
--- /dev/null
+++ b/vendor/github.com/phayes/checkstyle/.scrutinizer.yml
@@ -0,0 +1,15 @@
+build:
+ dependencies:
+ before:
+ - 'source <(curl -fsSL https://raw.githubusercontent.com/phayes/go-scrutinize/master/install-golang)'
+
+ tests:
+ override:
+ -
+ command: 'cd $PROJECTPATH && go-scrutinize'
+ coverage:
+ file: 'coverage.xml'
+ format: 'clover'
+ analysis:
+ file: 'checkstyle_report.xml'
+ format: 'general-checkstyle' \ No newline at end of file
diff --git a/vendor/github.com/phayes/checkstyle/LICENSE b/vendor/github.com/phayes/checkstyle/LICENSE
new file mode 100644
index 000000000..6dc912f39
--- /dev/null
+++ b/vendor/github.com/phayes/checkstyle/LICENSE
@@ -0,0 +1,29 @@
+BSD 3-Clause License
+
+Copyright (c) 2017, Patrick D Hayes
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/phayes/checkstyle/README.md b/vendor/github.com/phayes/checkstyle/README.md
new file mode 100644
index 000000000..358cf6752
--- /dev/null
+++ b/vendor/github.com/phayes/checkstyle/README.md
@@ -0,0 +1,44 @@
+# checkstyle
+[![GoDoc](https://godoc.org/github.com/phayes/checkstyle?status.svg)](https://godoc.org/github.com/phayes/checkstyle)
+[![Go Report Card](https://goreportcard.com/badge/github.com/phayes/checkstyle)](https://goreportcard.com/report/github.com/phayes/checkstyle)
+[![Build Status](https://scrutinizer-ci.com/g/phayes/checkstyle/badges/build.png?b=master)](https://scrutinizer-ci.com/g/phayes/checkstyle/build-status/master)
+
+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:
+
+```go
+
+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
diff --git a/vendor/github.com/phayes/checkstyle/checkstyle.go b/vendor/github.com/phayes/checkstyle/checkstyle.go
new file mode 100644
index 000000000..cabbd4b40
--- /dev/null
+++ b/vendor/github.com/phayes/checkstyle/checkstyle.go
@@ -0,0 +1,112 @@
+package checkstyle
+
+import "encoding/xml"
+import "io/ioutil"
+
+// DefaultCheckStyleVersion defines the default "version" attribute on "<checkstyle>" lememnt
+var DefaultCheckStyleVersion = "1.0.0"
+
+// Severity defines a checkstyle severity code
+type Severity string
+
+var (
+ SeverityError Severity = "error"
+ SeverityInfo Severity = "info"
+ SeverityWarning Severity = "warning"
+ SeverityIgnore Severity = "ignore"
+ SeverityNone Severity
+)
+
+// CheckStyle represents a <checkstyle> xml element found in a checkstyle_report.xml file.
+type CheckStyle struct {
+ XMLName xml.Name `xml:"checkstyle"`
+ Version string `xml:"version,attr"`
+ File []*File `xml:"file"`
+}
+
+// AddFile adds a checkstyle.File with the given filename.
+func (cs *CheckStyle) AddFile(csf *File) {
+ cs.File = append(cs.File, csf)
+}
+
+// GetFile gets a CheckStyleFile with the given filename.
+func (cs *CheckStyle) GetFile(filename string) (csf *File, ok bool) {
+ for _, file := range cs.File {
+ if file.Name == filename {
+ csf = file
+ ok = true
+ return
+ }
+ }
+ return
+}
+
+// EnsureFile ensures that a CheckStyleFile with the given name exists
+// Returns either an exiting CheckStyleFile (if a file with that name exists)
+// or a new CheckStyleFile (if a file with that name does not exists)
+func (cs *CheckStyle) EnsureFile(filename string) (csf *File) {
+ csf, ok := cs.GetFile(filename)
+ if !ok {
+ csf = NewFile(filename)
+ cs.AddFile(csf)
+ }
+ return csf
+}
+
+// String implements Stringer. Returns as xml.
+func (cs *CheckStyle) String() string {
+ checkStyleXML, err := xml.Marshal(cs)
+ if err != nil {
+ panic(err)
+ }
+ return string(checkStyleXML)
+}
+
+// New returns a new CheckStyle
+func New() *CheckStyle {
+ return &CheckStyle{Version: DefaultCheckStyleVersion, File: []*File{}}
+}
+
+// File represents a <file> xml element.
+type File struct {
+ XMLName xml.Name `xml:"file"`
+ Name string `xml:"name,attr"`
+ Error []*Error `xml:"error"`
+}
+
+// AddError adds a checkstyle.Error to the file.
+func (csf *File) AddError(cse *Error) {
+ csf.Error = append(csf.Error, cse)
+}
+
+// NewFile creates a new checkstyle.File
+func NewFile(filename string) *File {
+ return &File{Name: filename, Error: []*Error{}}
+}
+
+// Error represents a <error> xml element
+type Error struct {
+ XMLName xml.Name `xml:"error"`
+ Line int `xml:"line,attr"`
+ Column int `xml:"column,attr,omitempty"`
+ Severity Severity `xml:"severity,attr,omitempty"`
+ Message string `xml:"message,attr"`
+ Source string `xml:"source,attr"`
+}
+
+// NewError creates a new checkstyle.Error
+// Note that line starts at 0, and column starts at 1
+func NewError(line int, column int, severity Severity, message string, source string) *Error {
+ return &Error{Line: line, Column: column, Severity: severity, Message: message, Source: source}
+}
+
+// ReadFile reads a checkfile.xml file and returns a CheckStyle object.
+func ReadFile(filename string) (*CheckStyle, error) {
+ checkStyleXML, err := ioutil.ReadFile(filename)
+ if err != nil {
+ return nil, err
+ }
+ checkStyle := New()
+ err = xml.Unmarshal(checkStyleXML, checkStyle)
+ return checkStyle, err
+}
diff --git a/vendor/github.com/phayes/checkstyle/godoc.go b/vendor/github.com/phayes/checkstyle/godoc.go
new file mode 100644
index 000000000..c9662fe9e
--- /dev/null
+++ b/vendor/github.com/phayes/checkstyle/godoc.go
@@ -0,0 +1,36 @@
+/*
+Package checkstyle allows the parsing of generation of checkstyle XML files.
+
+Checkstyle XML files are a standard file format for reporting errors in source code, and is often generated by static analysis tools.
+
+Example usage:
+ // 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, column 5
+ codingError := checkstyle.NewError(10, 5, checkstyle.SeverityWarning, "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
+*/
+package checkstyle