mszostok / codeowners-validator

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

Validation doesn't fail on invalid syntax with EOL comments #33

Closed knl closed 3 years ago

knl commented 4 years ago

Description

If CODEOWNERS file contains a comment towards the end of the line, the validator doesn't flag it as invalid. In case of such comments, GitHub will skip the rest of the file.

Example:

# This comment is ok
* @someorg/someteam  # this comment is a syntax error

Expected result

I would expect the above snippet to be marked as problematic.

Actual result

env REPOSITORY_PATH="." OWNER_CHECKER_REPOSITORY="someorg/somerepo" CHECKS="files,duppatterns" $(go env GOPATH)/bin/codeowners-validator
==> Executing Duplicated Pattern Checker (30.265µs)
    Check OK
==> Executing File Exist Checker (40.374µs)
    Check OK

Note that I'm not using owners check, as it is not clear what kind of right are needed for the token (but that is a separate issue).

Steps to reproduce

Write a comment after a correct line (so that # is not the first character in the line).

Troubleshooting

mszostok commented 4 years ago

ICYMI: Please see my comment https://github.com/mszostok/codeowners-validator/pull/34#pullrequestreview-404882383 :)

btw. documentation for the token in owners check was added https://github.com/mszostok/codeowners-validator/pull/36