| 1 |
// Package checkstyle provides checkstyle utility. |
| 2 |
// http://checkstyle.sourceforge.net/ |
| 3 |
package checkstyle |
| 4 |
|
| 5 |
import "encoding/xml" |
| 6 |
|
| 7 |
// Result represents checkstyle XML result. |
| 8 |
// <?xml version="1.0" encoding="utf-8"?><checkstyle version="4.3"><file ...></file>...</checkstyle> |
| 9 |
// |
| 10 |
// References: |
| 11 |
// - http://checkstyle.sourceforge.net/ |
| 12 |
// - http://eslint.org/docs/user-guide/formatters/#checkstyle |
| 13 |
type Result struct { |
| 14 |
XMLName xml.Name `xml:"checkstyle"` |
| 15 |
Version string `xml:"version,attr"` |
| 16 |
Files []*File `xml:"file,omitempty"` |
| 17 |
} |
| 18 |
|
| 19 |
// File represents <file name="fname"><error ... />...</file> |
| 20 |
type File struct { |
| 21 |
Name string `xml:"name,attr"` |
| 22 |
Errors []*Error `xml:"error"` |
| 23 |
} |
| 24 |
|
| 25 |
// Error represents <error line="1" column="10" severity="error" message="msg" source="src" /> |
| 26 |
type Error struct { |
| 27 |
Column int `xml:"column,attr,omitempty"` |
| 28 |
Line int `xml:"line,attr"` |
| 29 |
Message string `xml:"message,attr"` |
| 30 |
Severity string `xml:"severity,attr,omitempty"` |
| 31 |
Source string `xml:"source,attr,omitempty"` |
| 32 |
} |