-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore GitLab sections #20
Conversation
Thanks @matteosilv! Looking at the GitHub CODEOWNERS syntax doc the only mention of So, I think this remains compatible with both. |
@matteosilv would you be able to add some tests to cover this functionality? |
@hairyhenderson never had time to do that sorry. Hopefully I can add test ASAP |
@matteosilv @hairyhenderson Testing could be something like this: diff --git a/codeowners_test.go b/codeowners_test.go
index a1b6620..4f81770 100644
--- a/codeowners_test.go
+++ b/codeowners_test.go
@@ -24,6 +24,10 @@ var (
docs/** @org/docteam @joe`
sample2 = `* @hairyhenderson`
sample3 = `baz/* @baz @qux`
+ sample4 = `[test]
+* @everyone
+[test2][2]
+*/foo @everyoneelse`
codeowners []Codeowner
)
@@ -40,6 +44,17 @@ func TestParseCodeowners(t *testing.T) {
assert.Equal(t, expected, c)
}
+func TestParseCodeownersSections(t *testing.T) {
+ t.Parallel()
+ r := bytes.NewBufferString(sample4)
+ c := parseCodeowners(r)
+ expected := []Codeowner{
+ co("*", []string{"@everyone"}),
+ co("*/foo", []string{"@everyoneelse"}),
+ }
+ assert.Equal(t, expected, c)
+}
+
func BenchmarkParseCodeowners(b *testing.B) {
r := bytes.NewBufferString(sample)
var c []Codeowner At least for me that solves the testing part of it. Hopefully you'll be able to push this for a release then :) |
Thanks for taking the time to work that out, @SirUli! |
GitLab-flavored CODEOWNERS style supports sections within [] characters. This change ignores them as it is for comments.
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Awesome, thanks! Are you planning on creating a release sometime soon? |
@SirUli yes I will - just needed to sort a few other things out first |
GitLab-flavored CODEOWNERS style supports sections within [] characters.
This change ignores them as it is for comments.