File tree Expand file tree Collapse file tree 2 files changed +42
-41
lines changed
Expand file tree Collapse file tree 2 files changed +42
-41
lines changed Original file line number Diff line number Diff line change 1+ package revgrep
2+
3+ // Issue contains metadata about an issue found.
4+ type Issue struct {
5+ // File is the name of the file as it appeared from the patch.
6+ File string
7+ // LineNo is the line number of the file.
8+ LineNo int
9+ // ColNo is the column number or 0 if none could be parsed.
10+ ColNo int
11+ // HunkPos is position from file's first @@, for new files this will be the line number.
12+ // See also: https://developer.github.com/v3/pulls/comments/#create-a-comment
13+ HunkPos int
14+ // Issue text as it appeared from the tool.
15+ Issue string
16+ // Message is the issue without file name, line number and column number.
17+ Message string
18+ }
19+
20+ // InputIssue represents issue found by some linter.
21+ type InputIssue interface {
22+ FilePath () string
23+ Line () int
24+ }
25+
26+ type simpleInputIssue struct {
27+ filePath string
28+ lineNumber int
29+ }
30+
31+ func (i simpleInputIssue ) FilePath () string {
32+ return i .filePath
33+ }
34+
35+ func (i simpleInputIssue ) Line () int {
36+ return i .lineNumber
37+ }
Original file line number Diff line number Diff line change @@ -43,47 +43,6 @@ type Checker struct {
4343 changes map [string ][]pos
4444}
4545
46- // Issue contains metadata about an issue found.
47- type Issue struct {
48- // File is the name of the file as it appeared from the patch.
49- File string
50- // LineNo is the line number of the file.
51- LineNo int
52- // ColNo is the column number or 0 if none could be parsed.
53- ColNo int
54- // HunkPos is position from file's first @@, for new files this will be the line number.
55- // See also: https://developer.github.com/v3/pulls/comments/#create-a-comment
56- HunkPos int
57- // Issue text as it appeared from the tool.
58- Issue string
59- // Message is the issue without file name, line number and column number.
60- Message string
61- }
62-
63- // InputIssue represents issue found by some linter.
64- type InputIssue interface {
65- FilePath () string
66- Line () int
67- }
68-
69- type simpleInputIssue struct {
70- filePath string
71- lineNumber int
72- }
73-
74- type pos struct {
75- lineNo int // line number
76- hunkPos int // position relative to first @@ in file
77- }
78-
79- func (i simpleInputIssue ) FilePath () string {
80- return i .filePath
81- }
82-
83- func (i simpleInputIssue ) Line () int {
84- return i .lineNumber
85- }
86-
8746// Prepare extracts a patch and changed lines.
8847func (c * Checker ) Prepare (ctx context.Context ) error {
8948 err := c .preparePatch (ctx )
@@ -350,3 +309,8 @@ func (c *Checker) linesChanged() map[string][]pos {
350309
351310 return changes
352311}
312+
313+ type pos struct {
314+ lineNo int // line number
315+ hunkPos int // position relative to first @@ in file
316+ }
You can’t perform that action at this time.
0 commit comments