-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix validateNoDuplicateNames #4815
Fix validateNoDuplicateNames #4815
Conversation
/assign @dibyom |
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 this fix @chuangw6!
please add more context to the commit message and PR description per the commit message standards, which can include the detail that the function was intended to be case insensitive as demonstrated by lines 150 and 155 below:
pipeline/pkg/apis/pipeline/v1beta1/taskrun_validation.go
Lines 150 to 155 in 6f39e94
// Case insensitive. | |
// If byIndex is true, the error will be reported by index instead of by key. | |
func validateNoDuplicateNames(names []string, byIndex bool) (errs *apis.FieldError) { | |
seen := sets.NewString() | |
for i, n := range names { | |
if seen.Has(strings.ToLower(n)) { |
also, please add documentation that the params are case-insensitive (skimmed through the docs and they don't seem to mention this)
LGTM! |
Prior to this fix, validateNoDuplicateNames function was intended to check case-insensitive duplications against names, but it saved original names into the set to compare. In this fix, validateNoDuplicateNames will save names in lower case into the check set and then compare.
b656a84
to
f656351
Compare
f656351
to
342caa7
Compare
Thanks! Done! |
342caa7
to
bf7cde2
Compare
Prior to this commit, parameter names will be checked against duplicates (case-insensitive), but it's not mentioned in the documentation that parameter names are case-insensitive. Also add links to tasks.md's "Specifying `Parameters`" section in other related files.
bf7cde2
to
4b8073f
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dibyom, vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
/retest |
Changes
Fixes #4814
Prior to this fix,
validateNoDuplicateNames
function was intended to check case-insensitive duplications against names, but it saved original names into the set to compare, which can cause that duplicate names cannot be checked correctly - mentioned in #4814.In this fix:
validateNoDuplicateNames
will save names in lower case into the check set and then compare.docs/tasks.md
file and add links to this file'sSpecifying Parameters
section in other relevant files.Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
(if there are no user facing changes, use release note "NONE")
Release Notes