Skip to content

Fix comment ignores not working for group fields#4370

Open
04cb wants to merge 1 commit intobufbuild:mainfrom
04cb:fix/group-field-comment-ignores
Open

Fix comment ignores not working for group fields#4370
04cb wants to merge 1 commit intobufbuild:mainfrom
04cb:fix/group-field-comment-ignores

Conversation

@04cb
Copy link

@04cb 04cb commented Mar 7, 2026

For proto2 group fields, comments in source get attributed to the synthetic message that holds the group's fields, not the group field itself. This caused buf:lint:ignore comments on group field declarations to not be respected for errors on fields within the group.

This fix adds logic to detect when a source path points to a descriptor within a synthetic message created for a group field, and also checks the parent group field's source path for comment ignores.

Fixes #4187

For proto2 group fields, comments in source get attributed to the
synthetic message that holds the group's fields, not the group field
itself. This caused buf:lint:ignore comments on group field
declarations to not be respected for errors on fields within the
group.

This fix adds logic to detect when a source path points to a descriptor
within a synthetic message created for a group field, and also checks
the parent group field's source path for comment ignores.

Fixes bufbuild#4187
@CLAassistant
Copy link

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