Skip to content
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

[chore]: enable float-compare rule from testifylint #35167

Closed

Conversation

mmorel-35
Copy link
Contributor

Description

Testifylint is a linter that provides best practices with the use of testify.

This PR enables float-compare rule from testifylint

@songy23 songy23 added the ci-cd CI, CD, testing, build issues label Sep 13, 2024
Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

It seems unlikely that 0.01 is an appropriate level of precision for every float comparison across all tests in the codebase.

For example, in one instance we were validating the number 3.15759539000001e+08 exactly (which presumably reflects an intended value of 3.15759539e+08), but now we would be passing it if it were 3.166 or 3.148

I think we need to try to ascertain an intended level of precision on a case by case basis, and short of that we should not adopt the linter if the current code is not causing problems.

@mmorel-35
Copy link
Contributor Author

I can drop this PR and the other on opentelemetry-collector and focus on other rules if you want?

@mmorel-35 mmorel-35 marked this pull request as draft September 13, 2024 17:07
@djaglowski
Copy link
Member

I'm open to other opinions but mine is that this linter doesn't provide much value unless we're encountering problems from not using it.

@mmorel-35 mmorel-35 force-pushed the testifylint/float-compare branch 5 times, most recently from f5c9b70 to e1785be Compare September 19, 2024 19:08
@mmorel-35 mmorel-35 marked this pull request as ready for review September 19, 2024 19:09
@mmorel-35 mmorel-35 requested a review from a team as a code owner September 19, 2024 19:09
@mmorel-35 mmorel-35 force-pushed the testifylint/float-compare branch 2 times, most recently from 3cf7232 to 52b8f49 Compare September 20, 2024 04:16
@mmorel-35 mmorel-35 force-pushed the testifylint/float-compare branch 3 times, most recently from fdceb2b to a51e559 Compare September 20, 2024 04:29
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants