Skip to content

Update the PROTOVALIDATE lint rule to check NaN#4542

Merged
oliversun9 merged 3 commits into
mainfrom
osun/lint-nan-cmp
May 14, 2026
Merged

Update the PROTOVALIDATE lint rule to check NaN#4542
oliversun9 merged 3 commits into
mainfrom
osun/lint-nan-cmp

Conversation

@oliversun9
Copy link
Copy Markdown
Contributor

@oliversun9 oliversun9 commented May 14, 2026

Updates the PROTOVALIDATE rule to detect NaN in const, lt, lte, gt, gte, in and not_in in both floating point number types.

Doesn't check for infinities.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 14, 2026, 9:21 PM

@oliversun9 oliversun9 changed the title Update PROTOVALIDATE lint rule to check NaN Update the PROTOVALIDATE lint rule to check NaN May 14, 2026
adder.getFieldRuleName(ruleFieldNumber, fieldNumber),
)
}
case "in":
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the bodies of "in" and "not_in" are the same except for part of the error message, I would merge the cases and build different strings depending on the value of field.Name()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2d611e3

@oliversun9 oliversun9 requested a review from jonbodner-buf May 14, 2026 20:50
@oliversun9 oliversun9 requested a review from jonbodner-buf May 14, 2026 21:22
@oliversun9 oliversun9 merged commit 3055385 into main May 14, 2026
10 checks passed
@oliversun9 oliversun9 deleted the osun/lint-nan-cmp branch May 14, 2026 21:26
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.

2 participants