-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: scoverage statement's line number should be 1-base (#18932)
fix #18916 This PR makes scoverage statements' line number 1-base, instead of 0-base. FYI @tarao It would be ideal if we could find specifications of many of coverage report fomats (such as Jacoco XML, cobertura.xml, lcov.txt...) and confirm most of them expect the line numbers 1-base. However, it seems there's no formal specification for them AFAIK. Since we've been using 1-base so far in Scala2 and it hasn't been a problem, so I guess it's OK to change to 1-base (and most of coverage report format and visualizer expect 1-base probably). I believe we should make coverage report 1-base by default, and it should be reporter / aggregator's responsibility to adjust the line numbers if some coverage format expects 0-base. --- I tested on https://github.com/scoverage/sbt-scoverage-samples with HTML reporter ## 3.3.1 ![Screenshot 2023-11-15 at 16 55 06](https://github.com/lampepfl/dotty/assets/9353584/909b7eeb-22ca-41ca-bdfb-dc1e3ceb8ebb) ![Screenshot 2023-11-15 at 16 55 11](https://github.com/lampepfl/dotty/assets/9353584/97f086e2-f597-40e8-bee0-7a5d2dac9294) In the latter picture, they are "3" even though the actual line number is 4, because - scoverage deserializer parses `scoverage.coverage`'s line number as it is - https://github.com/scoverage/scalac-scoverage-plugin/blob/dd519767c916293f6d200639641a7f029970e261/serializer/src/main/scala/scoverage/serialize/Serializer.scala#L147 - and StatementWriter uses the `line` number without adjustment (to 1-base) - https://github.com/scoverage/scalac-scoverage-plugin/blob/dd519767c916293f6d200639641a7f029970e261/reporter/src/main/scala/scoverage/reporter/StatementWriter.scala#L34-L36 ## 3.4.0-RC1-bin-SNAPSHOT ![Screenshot 2023-11-15 at 17 41 06](https://github.com/lampepfl/dotty/assets/9353584/6cbcaebd-3fae-4fcb-ae22-fc4bd844563a) seems ok 👍 ![Screenshot 2023-11-15 at 17 41 01](https://github.com/lampepfl/dotty/assets/9353584/ca16653f-267c-4e43-962c-abdbf277f30f)
- Loading branch information
Showing
39 changed files
with
420 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.