Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for automatic sorting of paths #6

Open
zegl opened this issue May 27, 2019 · 3 comments · May be fixed by #9
Open

Support for automatic sorting of paths #6

zegl opened this issue May 27, 2019 · 3 comments · May be fixed by #9

Comments

@zegl
Copy link
Owner

zegl commented May 27, 2019

Comment from @JensRantil in a private repository, I'm adding it as an issue here as a reminder to decide what to do about it.

How about generate_codeowners ordering according to

  1. Shortest first; otherwise
  2. Lexicographically.

That way the codeowners file will always be do more specific paths first which likely is what you want, right?

@sudoforge
Copy link

sudoforge commented Jul 15, 2019

Longest first; otherwise

This wouldn't work with the way GitHub parses the CODEOWNERS file.

That way the codeowners file will always be do more specific paths first which likely is what you want, right?

On GitHub, you want more specific paths last, not first. See About CODEOWNERS for more information about the syntax. To summarize:

* # default owner(s)
*.js # something a little less generic
src/foo/bar/baz/*.go # an even more specific path

@zegl
Copy link
Owner Author

zegl commented Jul 15, 2019

@sudoforge You're of course correct! I'll update the description. 👍

@zegl zegl linked a pull request Jul 15, 2019 that will close this issue
@sudoforge
Copy link

I think sort should work for most cases, but the **/{foo} syntax may be cause for concern

→ cat CODEOWNERS | rg --invert-match '^\#|^\s*$' | sort
* @global-reviewers
**/CODEOWNERS @nested-codeowners-reviewers
*.html @html-reviewers
*.js @js-reviewers
/src/slack-chat-bot @slack-chat-bot-reviewers
/src/potato-pie @pie-reviewers
BUILD* @build-tools-reviewers
CODEOWNERS @all-codeowners-reviewers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants