Closed knl closed 3 years ago
@mszostok I see your point. What about instead of dividing valid_owner.go
to work in two different modes, introduce a new check valid_syntax.go
? Because in the code I'm proposing, owner format is in focus at it takes the bulk of the file. However, the real issue I'm trying to deal with is the syntax of the file. As you can see, I'm also checking if there is only one token on the line. In addition, what is missing, in order to have a parity matching with .gitignore, is the handling of line continuation (\
at the end of the line). None of those are related to owners.
@knl you are right, my bad 🤦 Adding new check makes more sens 👍
are you interested in implementing such check?
Thanks for your work on this issue, because of inactivity I decided to extract implemented logic as discussed :)
Closing in favor: https://github.com/mszostok/codeowners-validator/pull/46
Description
A significant class of errors with CODEOWNERS file are syntax errors, that is, malformed entries.
This change adds checks for validating the codeowners file while it is being parsed.
It will do a couple of simple checks, like:
pattern owner1 ... ownerN
Related issue(s)
Fixes #33