File tree 1 file changed +21
-10
lines changed
1 file changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -867,18 +867,29 @@ func getTagsFromComment(comment string) (tags []string) {
867
867
}
868
868
869
869
func (parser * Parser ) matchTags (comments []* ast.Comment ) (match bool ) {
870
- if len (parser .tags ) != 0 {
871
- for _ , comment := range comments {
872
- for _ , tag := range getTagsFromComment (comment .Text ) {
873
- if _ , has := parser .tags ["!" + tag ]; has {
874
- return false
875
- }
876
- if _ , has := parser .tags [tag ]; has {
877
- match = true // keep iterating as it may contain a tag that is excluded
878
- }
870
+ if len (parser .tags ) == 0 {
871
+ return true
872
+ }
873
+
874
+ match = false
875
+ for _ , comment := range comments {
876
+ for _ , tag := range getTagsFromComment (comment .Text ) {
877
+ if _ , has := parser .tags ["!" + tag ]; has {
878
+ return false
879
+ }
880
+ if _ , has := parser .tags [tag ]; has {
881
+ match = true // keep iterating as it may contain a tag that is excluded
882
+ }
883
+ }
884
+ }
885
+
886
+ if ! match {
887
+ // If all tags are negation then we should return true
888
+ for key := range parser .tags {
889
+ if key [0 ] != '!' {
890
+ return false
879
891
}
880
892
}
881
- return
882
893
}
883
894
return true
884
895
}
You can’t perform that action at this time.
0 commit comments