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

review: fix(sniper): Fix rounding error in indentation detection on single type member #3722

Merged

Conversation

slarse
Copy link
Collaborator

@slarse slarse commented Dec 7, 2020

This fixes a rather silly rounding error in the indentation detection: if there's a single type member, usesTabs = 1 / 2 = 0. Therefore, a single type member will always be regarded as indented with tabs, regardless of actual indentation. It's extra silly because it affected the particular use case that I implemented the indentation detection for in the first place. Now explicitly uses doubles instead for the comparison.

Tiny rounding errors don't really matter here, in the general case there will either be 0 tabs or all tabs. It was just the massive rounding error of integer division of 1 / 2 that was problematic.

@slarse
Copy link
Collaborator Author

slarse commented Dec 7, 2020

@monperrus Any idea of why CI is not triggering?

@monperrus
Copy link
Collaborator

Because Builds have been temporarily disabled for public repositories due to a negative credit balance. Please go to the Plan page to replenish your credit balance or alter your Consume paid credits for OSS setting. source and #3600 for the cheapest solution to the problem.

@slarse
Copy link
Collaborator Author

slarse commented Dec 9, 2020

oops, my resources are missing

@slarse slarse changed the title wip: fix(sniper): Fix rounding error in indentation detection on single type member review: fix(sniper): Fix rounding error in indentation detection on single type member Dec 9, 2020
@slarse
Copy link
Collaborator Author

slarse commented Dec 9, 2020

This is ready for review

@slarse
Copy link
Collaborator Author

slarse commented Dec 9, 2020

@monperrus is c2bc881 supposed to be there or was it just to trigger CI?

@nharrand
Copy link
Collaborator

nharrand commented Dec 9, 2020

LGTM!

@nharrand nharrand merged commit 0804973 into INRIA:master Dec 9, 2020
@slarse slarse deleted the fix-indentation-detection-roundoff-error branch May 28, 2021 10:08
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.

3 participants