-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
✨ Remove spaces from machine-readable comments #1868
✨ Remove spaces from machine-readable comments #1868
Conversation
Hi @Adirio, It is not passing in the CI. Could you please check this one for we get it merged? looking for to check it passing in the CI fr we are able to merge this one. |
I think it is a rebase what it is needed. Will try it. |
9f8fedd
to
9f9e702
Compare
9f9e702
to
4ce7476
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.
Something like this can be done for any plugin, stable/frozen or not, since machine-readable comments with spaces are backwards compatible.
Hi @Adirio What was your motivation to define that #1384 (this change) would be a breaking change and that should be done only for v3? If it is backwards compatible with v2 then I agree with @estroz in #1868 (review). However, i imagine that you saw some scenario that would be affected. so, could you please clarify? |
If we apply this to v2, projects scaffolded with v2 before applyign this change will have spaces and further update operation by kubebuilder will not be able to find the placeholders. For example the ones in |
If that’s true, it sounds like a bug in controller-tools’ comment lexer. Both forms are valid marker comments so should be parsed in the same manner. |
I mean the comments that are meant for kubebuilder itself, for example the |
What about creating a method to compare marker comments like so func (m Marker) EqualsLine(line string) bool {
line = strings.TrimSpace(strings.TrimPrefix(m.comment))
return line == m.value
} and use it here: line := scanner.Text()
for marker, codeFragments := range codeFragmentsMap {
- if strings.TrimSpace(line) == strings.TrimSpace(marker.String()) {
+ if marker.EqualsLine(line) {
...
}
} |
The above is just a suggestion btw. Your solution also works. Feel free to unhold to merge as-is. /lgtm |
4ce7476
to
6edadd4
Compare
/unhold @estroz I liked your suggestion, removed the hold as the |
bd5b718
to
3b57509
Compare
3b57509
to
badc0da
Compare
/retest |
Hi @Adirio, it is not passing in the CI. Maybe it is missing a rebase? |
I don't know why but seems that one of the changes in Edit: Nevermind, it doesn't have to do with that. Trying to debug it further. |
3bbd8d2
to
d501fc3
Compare
The part that is failing is this one: kubebuilder/testdata/project-v3/api/v1/webhook_suite_test.go Lines 126 to 136 in d501fc3
I'm not modifying anything that should break that check. |
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.
d501fc3
to
2f97e21
Compare
Signed-off-by: Adrian Orive <[email protected]>
2f97e21
to
9ee7a30
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.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Adirio, estroz, prafull01 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 |
Description
Machine-readable comments used for markers have spaces after the comment character (
//
or#
), they have been removed to follow common coding practices.Closes: #1384
Comments to reviewers
131/144 files are from the
testdata
directory, this PR is smaller than what it looks like by the number of files changed.