Skip to content

Commit 8a95900

Browse files
authored
Move sanitiseLine function (#19)
1 parent fc2fc0a commit 8a95900

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

codeowners.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ import (
99
// DefaultLocations provides default locations for the CODEOWNERS file
1010
var DefaultLocations = [...]string{"CODEOWNERS", "docs/CODEOWNERS", ".github/CODEOWNERS"}
1111

12+
// sanitiseLine removes all empty space and comments from a given line
13+
func sanitiseLine(line string) string {
14+
i := strings.Index(line, "#")
15+
if i >= 0 {
16+
line = line[:i]
17+
}
18+
return strings.Trim(line, " ")
19+
}
20+
1221
// ParseLine parses a CODEOWNERS line into file pattern and owners
1322
func ParseLine(line string) (string, []string) {
1423
line = sanitiseLine(line)

decoder.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package codeowners
33
import (
44
"bufio"
55
"io"
6-
"strings"
76
)
87

98
// Decoder providers functionality to read CODEOWNERS data
@@ -39,15 +38,6 @@ func (d *Decoder) peek() {
3938
}
4039
}
4140

42-
// sanitiseLine removes all empty space and comments from a given line
43-
func sanitiseLine(line string) string {
44-
i := strings.Index(line, "#")
45-
if i >= 0 {
46-
line = line[:i]
47-
}
48-
return strings.Trim(line, " ")
49-
}
50-
5141
// More returns true if there are available CODEOWNERS lines to be scanned.
5242
// And also advances to the next line.
5343
func (d *Decoder) More() bool {

0 commit comments

Comments
 (0)