docs icon indicating copy to clipboard operation
docs copied to clipboard

CODEOWNERS file syntax documentation does not make it explicitly clear that a pattern can only be used once

Open ReidWeb opened this issue 3 years ago • 4 comments

[maintainer edit] This issue is reserved for the MLH Fellowship program.

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

What changes are you suggesting?

The existing documentation for file syntax does not make it explicitly clear that a pattern can only be specified once, and that if >1 instance of a pattern is present, the last instance will take precedence.

For example the following example would only request review from @doctocat, @octocat would not be included in the reviewers.

apps/ @octocat
apps/ @doctocat

I would propose that a line be added to the CODEOWNERS syntax section indicating that a repeated pattern is not supported.

Additional information

Additionally, I believe an issue should be raised internally against the validation of codeowners files - the above example will be marked as valid by the CODEOWNERS validation, and will not provide any indication to the end user that only the last instance of the pattern will be used.

Content plan

Found here

ReidWeb avatar Apr 13 '22 14:04 ReidWeb

@ReidWeb Thanks so much for opening an issue! I'll triage this for the team to review :eyes:

ramyaparimi avatar Apr 14 '22 11:04 ramyaparimi

Thanks @ReidWeb! We can definitely mention that if you want to list two code owners for the same pattern, they should be on the same line, because using multiple lines will fall prey to the "last matching pattern takes the most precedence" rule. 👍🏻 You or anyone else is welcome to open a PR for that!

lecoursen avatar Apr 14 '22 15:04 lecoursen

I would like to work on this issue!

nawed2611 avatar Jul 16 '22 06:07 nawed2611

@nawed2611 You or anyone else is welcome to work on this issue! 💖

cmwilson21 avatar Jul 18 '22 13:07 cmwilson21