-
Notifications
You must be signed in to change notification settings - Fork 24
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
escape globs derived from .codeowner files #106
Conversation
8b99758
to
1fb284d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Globs can contain certain regex characters, like "[" and "]". However, when we are generating a glob from a .codeowners file, we need to escape bracket characters and interpret them literally.
This seems like a potentially breaking change, since it would have been valid been valid to have brackets in globs previously, and now they are changing.
[set]
Matches any one character in set. Behaves exactly like character sets in Regexp, including set negation ([^a-z]).
If that is the case, I think this probably needs a major version bump.
Separately... I wonder if it works as expected without this change if you escape filenames in the codeowner file 🤔
Are you referring to globs that are defined in a team's config? Those are parsed in a separate mapper and not changed by this PR. You can still use brackets in those globs to define a range of characters, or escape them if you want to match on the bracket characters themselves.
This PR affects the ownership method where a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying 🙇🏻
Github CODEOWNERS files don't appear to support brackets for ranges of characters. We don't have any special handling for that, so I suspect that using brackets in this gem does not work today. |
Globs can contain certain regex characters, like "[" and "]". However, when we are generating a glob from a .codeowners file, we need to escape bracket characters and interpret them literally. Otherwise the resulting glob will not actually match the directory containing the .codeowners file.
Example