codeowners icon indicating copy to clipboard operation
codeowners copied to clipboard

Invalid codeowners should be filtered out

Open pratikmallya opened this issue 4 years ago • 2 comments

e.g. if a file has a codeowners like:

a/** cool-team # TODO: change

this library spits out 4 code owners: cool-team, #, TODO: and change. While nothing can be done for change at least # is a known invalid codeowner

pratikmallya avatar Apr 22 '20 14:04 pratikmallya

afaik, You can't have comments on rule lines, so this would actually be invalid. You'd have to write:

# TODO: change
a/** @cool-team

Further more, you'd need the @ sign for GitHub and GitLab to handle the team/username correctly.

See:

  • https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
  • https://docs.gitlab.com/ee/user/project/code_owners.html#the-syntax-of-code-owners-files

ThisIsMissEm avatar Aug 31 '20 11:08 ThisIsMissEm

For invalid syntax, perhaps the library should indicate that and/or fail rather than continuing to parse the invalid data and generating invalid codeowners.

pratikmallya avatar Sep 10 '20 02:09 pratikmallya