Maksym 219a5479c8 Checkstyle support (#95)
Implement checkstyle printer
2018-06-13 20:54:13 +03:00

47 lines
639 B
Go

package result
import "go/token"
type Range struct {
From, To int
}
type Issue struct {
FromLinter string
Text string
Pos token.Position
LineRange *Range `json:",omitempty"`
HunkPos int `json:",omitempty"`
}
func (i Issue) FilePath() string {
return i.Pos.Filename
}
func (i Issue) Line() int {
return i.Pos.Line
}
func (i Issue) Column() int {
return i.Pos.Column
}
func (i Issue) GetLineRange() Range {
if i.LineRange == nil {
return Range{
From: i.Line(),
To: i.Line(),
}
}
if i.LineRange.From == 0 {
return Range{
From: i.Line(),
To: i.Line(),
}
}
return *i.LineRange
}