-
Notifications
You must be signed in to change notification settings - Fork 25
Detect markers separated by blank lines from type declarations #187
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
base: main
Are you sure you want to change the base?
Detect markers separated by blank lines from type declarations #187
Conversation
6e5b936 to
41060d9
Compare
| // SingleLineMarkerTest has a single marker separated by blank line. | ||
| // This marker should still be detected because it's part of the Doc comment group. | ||
| type SingleLineMarkerTest struct { | ||
| Name string `json:"name"` | ||
| } |
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.
How do we know that the marker is being detected?
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.
Ah right. I've updated the implementation to actually detect single-line markers separated by blank lines.
41060d9 to
847529f
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: saschagrunert The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
847529f to
4a14f71
Compare
This fixes issue kubernetes-sigs#53 by detecting kubebuilder markers that are separated from type declarations by blank lines. Both single-line and multi-line marker groups are now properly detected. - Modified marker analyzer to check the previous comment group - Added extractOrphanedMarkers and helper functions - Added constants for marker prefix and separation limits - Added logic to skip commented-out code blocks - Renamed containsMultilineMarkers to containsMarkers for clarity - Added comprehensive test cases covering: - Multi-line markers with blank lines (BlankLineTest) - Single-line markers with blank lines (SingleLineMarkerTest) - Distance limits preventing false positives (TooFarAwayTest) - Commented-out code rejection (CommentedCodeTest) - List types with blank line markers (ServiceList) Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
4a14f71 to
f28c4cf
Compare
This fixes issue #53 by detecting kubebuilder markers that are separated
from type declarations by blank lines. Both single-line and multi-line
marker groups are now properly detected.