mszostok / codeowners-validator

The GitHub CODEOWNERS file validator
Apache License 2.0
217 stars 47 forks source link

Check for syntax errors in CODEOWNERS file #34

Closed knl closed 3 years ago

knl commented 4 years ago

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:

Related issue(s)

Fixes #33

knl commented 4 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.

mszostok commented 4 years ago

@knl you are right, my bad 🤦 Adding new check makes more sens 👍

are you interested in implementing such check?

mszostok commented 3 years ago

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