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

Examples of CODEOWNERS ! negation #19818

Closed
1 task done
Tracked by #34807
jamesbraza opened this issue Aug 15, 2022 · 7 comments
Closed
1 task done
Tracked by #34807

Examples of CODEOWNERS ! negation #19818

jamesbraza opened this issue Aug 15, 2022 · 7 comments
Labels
code owners Content related to code owners content This issue or pull request belongs to the Docs Content team repositories Content related to repositories waiting for review Issue/PR is waiting for a writer's review

Comments

@jamesbraza
Copy link

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?

Currently for negation, there is one mention of it in the docs:

Using ! to negate a pattern

There should be an example showing a negation. I am struggling to figure out how to use this feature.

GitHub UI is saying "invalid pattern" for either of these:

!directory/* @some-owner
! directory/* @some-owner

I think an example would be a great way to spell out how to do negation.

Additional information

No response

@jamesbraza jamesbraza added the content This issue or pull request belongs to the Docs Content team label Aug 15, 2022
@welcome
Copy link

welcome bot commented Aug 15, 2022

Thanks for opening this issue. A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Aug 15, 2022
@cmwilson21 cmwilson21 added waiting for review Issue/PR is waiting for a writer's review code owners Content related to code owners repositories Content related to repositories and removed triage Do not begin working on this issue until triaged by the team labels Aug 16, 2022
@janiceilene
Copy link
Contributor

👋 @jamesbraza The section of the docs that includes the ! syntax says:

Syntax exceptions
There are some syntax rules for gitignore files that do not work in CODEOWNERS files:

Escaping a pattern starting with # using \ so it is treated as a pattern and not a comment
Using ! to negate a pattern
Using [ ] to define a character range

The patterns listed there \, !, and [ ] do not work in CODEOWNERS files, so we are not going to add any examples.

Thanks so much for opening an issue!

@jamesbraza
Copy link
Author

HA that is funny, I must have totally misread the docs. Thank you @janiceilene!

@JasonWHowell
Copy link
Contributor

JasonWHowell commented Sep 27, 2024

Oddly, I misread the doc to say it worked, instead of NOT worked. It spent 30 minutes until I found this issue and reread it as "do not work". I wish each example said "... doesn't work" at the end of the three sentences.

During my futile testing, I found using ! still validates. Is that a bug, or does it treat the ! as a literal?
image

@nguyenalex836
Copy link
Contributor

During my futile testing, I found using ! still validates. Is that a bug, or does it treat the ! as a literal?

@subatoi Would you have any insight on this? 🤔

@subatoi
Copy link
Contributor

subatoi commented Sep 30, 2024

👋 Thanks for the ping. I'm hoping the following will help:

  • I have no problem with creating an issue to add "doesn't work" to each of the three sentences in question, and opening it to contributors. We have a freeze this week, but can happily merge a PR next week if it's been raised by then

  • The negation syntax will only "work" with a space between ! and the target, so the example in the image will count as valid CODEOWNERS syntax because it's not valid negation syntax—I'm hoping that my point above will clarify the situation for any future readers sufficiently, though (ie don't expect negation syntax to work at all)

@nguyenalex836
Copy link
Contributor

I have no problem with creating an issue to add "doesn't work" to each of the three sentences in question, and opening it to contributors.

I've opened the following issue to have the doc updated! #34805

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code owners Content related to code owners content This issue or pull request belongs to the Docs Content team repositories Content related to repositories waiting for review Issue/PR is waiting for a writer's review
Projects
None yet
Development

No branches or pull requests

6 participants