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

Print Doubles with two fraction digits using US locale #157

Merged
merged 2 commits into from
Mar 28, 2016
Merged

Print Doubles with two fraction digits using US locale #157

merged 2 commits into from
Mar 28, 2016

Conversation

lustefaniak
Copy link
Contributor

In some locales (eg. polish), doubles are printed with , as decimal separator:

<scoverage statement-count="1250" statements-invoked="213" statement-rate="17,04" branch-rate="17,91" version="1.0" timestamp="1458599746821">

Which is not correct as it breaks all code relying on .toDouble in scala.

@gslowikowski
Copy link
Member

I like this change, Scoverage reports should be locale and encoding agnostic.

I've just checked Scoverage Jenkins plugin sources. This plugin reads statement-rate and branch-rate from scoverage.xml and parses it using Double.parseDouble. parseDouble method does not support locales, so it shouldn't work now, if dot is not your decimal separator.

I didn't test it, just analyzed source code. You can talk to the author to confirm this (he is very kind person).

@lustefaniak
Copy link
Contributor Author

I did that change after codacy/sbt-codacy-coverage was crashing on my machine.

Cobertura report had decimals printed as in sample snippet. Most of the scala code uses .toDouble or .toFloat and unfortunatelly it allows only . as decimal separator.

Double.parseDouble uses FloatingDecimal.parseDouble and I think that one is Locale agnostic so it should be fine.

@lustefaniak
Copy link
Contributor Author

@sksamuel Hi Stephen, I tried changes locally and they work for me, is there anything more I should check to get it merged?

@gslowikowski
Copy link
Member

Additionally you should revert this commit.

@lustefaniak
Copy link
Contributor Author

I think it is already done, but I will do it explicitly as git revert

@gslowikowski
Copy link
Member

LGTM, will test later with my scoverage-maven-plugin.

@jketterl
Copy link

this PR was just braught to my attention... i think this will fix bug #126 i reported a while back.

@gslowikowski
Copy link
Member

Yes

@sksamuel sksamuel merged commit f649e50 into scoverage:master Mar 28, 2016
@lustefaniak lustefaniak deleted the print-decimals-with-us-locale branch October 4, 2016 08:16
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.

4 participants