Skip to content

Respect comment ignores on proto2 group fields#4484

Open
lawrence3699 wants to merge 1 commit intobufbuild:mainfrom
lawrence3699:fix/group-comment-ignores
Open

Respect comment ignores on proto2 group fields#4484
lawrence3699 wants to merge 1 commit intobufbuild:mainfrom
lawrence3699:fix/group-comment-ignores

Conversation

@lawrence3699
Copy link
Copy Markdown

Fixes #4187

For proto2 group declarations, leading comments are attached to the synthetic nested message source location instead of the group field source location. That meant // buf:lint:ignore FIELD_NOT_REQUIRED on a required group declaration was still ignored even though the same comment worked on a normal required field.

This updates comment-ignore lookup to also check sibling source paths that share the same source span, which covers the field/synthetic-message pair for groups, and adds a regression test for the required-group case.

Validation:

  • go test ./private/bufpkg/bufcheck -run 'TestRunComments|TestRunFieldNotRequired(GroupCommentIgnore)?$' -count=1\n- go run ./cmd/buf lint /tmp/buf-group-ignore-eYGbo9 --error-format=json

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comment ignores are not being picked up by group fields

2 participants