-
Notifications
You must be signed in to change notification settings - Fork 369
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
Don't exclude spaces from the label name regex #1271
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,9 +65,7 @@ var ( | |
labelRepoRegexp = regexp.MustCompile(`^@$|^[A-Za-z.-][A-Za-z0-9_.-]*$`) | ||
labelPkgRegexp = regexp.MustCompile(`^[A-Za-z0-9/._@-]*$`) | ||
// This was taken from https://docs.bazel.build/versions/main/build-ref.html#name | ||
// Note: We've manually removed space from the regex, because though these technically parse | ||
// with Bazel (and can appear in query results), they cannot actually be used in practice. | ||
labelNameRegexp = regexp.MustCompile("^[A-Za-z0-9!%-@^_`\"#$&'()*-+,;<=>?\\[\\]{|}~/.]*$") | ||
labelNameRegexp = regexp.MustCompile("^[A-Za-z0-9!%-@^_` \"#$&'()*-+,;<=>?\\[\\]{|}~/.]*$") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've been bitten one too many times by "a small change to a regex that is trivial to visually validate". Could we add some test cases to prove this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a test :) |
||
) | ||
|
||
// Parse reads a label from a string. | ||
|
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.
Can you explain why this comment is no longer true?
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.
It was never really true - I made a limiting assumption which was incorrect. bazelbuild/bazel#4327 is an issue tracking fixing gaps in this support elsewhere in Bazel, too, which is an open and accepted issue, not something closed as working as intended.