@@ -981,14 +981,14 @@ func GetCodeOwnersFromContent(ctx context.Context, data string) ([]*CodeOwnerRul
981
981
warnings := make ([]string , 0 )
982
982
983
983
for i , line := range lines {
984
- tokens := tokenizeCodeOwnersLine (line )
984
+ tokens := TokenizeCodeOwnersLine (line )
985
985
if len (tokens ) == 0 {
986
986
continue
987
987
} else if len (tokens ) < 2 {
988
988
warnings = append (warnings , fmt .Sprintf ("Line: %d: incorrect format" , i + 1 ))
989
989
continue
990
990
}
991
- rule , wr := parseCodeOwnersLine (ctx , tokens )
991
+ rule , wr := ParseCodeOwnersLine (ctx , tokens )
992
992
for _ , w := range wr {
993
993
warnings = append (warnings , fmt .Sprintf ("Line: %d: %s" , i + 1 , w ))
994
994
}
@@ -1009,7 +1009,7 @@ type CodeOwnerRule struct {
1009
1009
Teams []* org_model.Team
1010
1010
}
1011
1011
1012
- func parseCodeOwnersLine (ctx context.Context , tokens []string ) (* CodeOwnerRule , []string ) {
1012
+ func ParseCodeOwnersLine (ctx context.Context , tokens []string ) (* CodeOwnerRule , []string ) {
1013
1013
var err error
1014
1014
rule := & CodeOwnerRule {
1015
1015
Users : make ([]* user_model.User , 0 ),
@@ -1064,15 +1064,15 @@ func parseCodeOwnersLine(ctx context.Context, tokens []string) (*CodeOwnerRule,
1064
1064
}
1065
1065
}
1066
1066
1067
- if len (rule .Users ) == 0 {
1068
- warnings = append (warnings , "no users matched" )
1067
+ if ( len (rule .Users ) == 0 ) && ( len ( rule . Teams ) == 0 ) {
1068
+ warnings = append (warnings , "no users/groups matched" )
1069
1069
return nil , warnings
1070
1070
}
1071
1071
1072
1072
return rule , warnings
1073
1073
}
1074
1074
1075
- func tokenizeCodeOwnersLine (line string ) []string {
1075
+ func TokenizeCodeOwnersLine (line string ) []string {
1076
1076
if len (line ) == 0 {
1077
1077
return nil
1078
1078
}
0 commit comments