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 negation globs #116

Open
mscrivo opened this issue Feb 7, 2025 · 2 comments
Open

Support negation globs #116

mscrivo opened this issue Feb 7, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@mscrivo
Copy link

mscrivo commented Feb 7, 2025

Negation globs seemingly don't work. For example, I can't do something like this:

- '!(workspaces)/**/sourcing/**/*'

to say that I want this team to own any folder that has a "sourcing" subfolder in the path, but not within any "workspaces" folders.

This works just fine when tested with compgen. code_ownership doesn't seem to throw an error when validating, but when checking a path that should be owned under that glob, say lib/sourcing/some_file.rb, it incorrect states that it's not owned. Interestingly, it still correctly updates the CODEOWNERS file with the negation glob.

So now, instead of having single glob that covers most of this team's ownership, I will have to explicitly map out each folder instead.

@github-actions github-actions bot added the triage A new issue that needs review by the core team label Feb 7, 2025
@mscrivo
Copy link
Author

mscrivo commented Feb 7, 2025

It seems this may be more a limitation of Dir.glob rather than this gem. It doesn't seem to support glob negations

@ashleywillard
Copy link
Contributor

Hi @mscrivo! Thanks for filing this issue. You're correct, currently code_ownership does not support this syntax, and there is that limitation with Dir.glob. One way to add support for excluding globs would be to add an unowned_globs array for teams. We would welcome this contribution if you'd like to make a pull request!

@ashleywillard ashleywillard added enhancement New feature or request and removed triage A new issue that needs review by the core team labels Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants