Comments (6)
It looks like identifier
is simply the value of the point's index i
. It's just a way to get the index of a code point, given only the point_definition
record, without doing a search in the points list. So, the answer to
what is the corresponding code point? Is it the one with identifier i or the one at index i in the list of code points?
is "both."
The naming of the field is confusing though, and the comment is not very helpful. We should fix that.
As for the type definitions, I agree it would make it clearer to understand what is really going on. Both the runtime data and the code point lists (i.e. .cmp
files) could use clear type definitions. I'll submit a PR – unless you would like to :)
from bisect_ppx.
Thanks for the clarification. I haven't looked at this but I would try to get rid of this redundancy by removing the identifier
field as there is the danger of inconsistencies. I'm currently working towards a more abstract interface to the runtime system but it has some parts that you are probably not going to be interested in: I want line numbers for each point. It looks like this and does not rely on array indices as they entire structure is tree shaped.
module SM: Map.S with type key = string
exception Error of string
type point = (** a code point in a source file *)
{ line: int (** line number *)
; offset: int (** byte offset from start *)
; kind: Bisect.Common.point_kind (** kind of point *)
; count: int (** number of hits *)
}
type file = (** a file with coverage analysis *)
{ digest: string (** cryptographic hash of content *)
; linecount: int (** number of lines *)
; points: point array (** points that were covered *)
}
type t = file SM.t (** a collection of files *)
val read: string -> string list -> t
The read
function takes the prefix directory and a list of *.out
files and builds a map that for each file has all the points and the number of hits.
from bisect_ppx.
The interface looks good in principle – not sure if you are still working on it. Line numbers may be fine if they simplify some useful processing, which is, I'm sure, why you're adding them. The existing offsets are weird, but I guess they are useful to how the HTML reporter works right now.
How would your desire to add line numbers be affected by storing the source code and point info together in the .out
files?
from bisect_ppx.
The reason why I want to support line numbers is that this is what editors and users understand best for navigating to a point. I've implemented them by scanning the source code and remembering all offsets of the newlines in the file. Given an offset, I can then find the corresponding line. Column numbers are difficult to support because they depend on the interpretation of tab characters.
If the source code is part of an out file, I could a compute line number from an offset later - so they would not have to be part of a point (although they are convenient and compact).
from bisect_ppx.
by scanning the source code and remembering all offsets of the newlines in the file.
I think you could also take line numbers from locations while instrumenting. This function and its caller would have to be modified to take a location.
from bisect_ppx.
Closing this for now, see #111 (comment). Please comment if this is still needed. The type is now here:
bisect_ppx/src/common/bisect_common.mli
Lines 11 to 14 in 8af03e4
It should be easy to add line numbers.
from bisect_ppx.
Related Issues (20)
- Invalid cobertura report HOT 8
- Semantic of `Lazy.is_val` changes using `bisect_ppx` HOT 3
- Confused about excluding/linking coverage files with Melange+Dune HOT 4
- Can't Install Fresh Clone HOT 2
- ReasonML support seems to be broken... HOT 1
- cannot advance to `rescript` `10` HOT 1
- Does not seem to instrument cram-style tests HOT 1
- `bisect_ppx` doesn't see the instrumentation clause in my library HOT 4
- Some Coverage Files are not Listed on HTML Coverage Overview HOT 1
- Tips on how to upgrade dependency: ppxlib to latest version? HOT 2
- Question: Does it work with dune's cram test? HOT 15
- Update readme to mention usage in Dune HOT 1
- Support [@coverage off] for or-patterns
- Proposal: add <packages> to cobertura report
- Proposal: support more mandatory fields from cobertura dtd HOT 5
- Bugs in expect_test test? HOT 2
- ppxlib >= 0.28 compatibility HOT 2
- Cannot understand why certain expressions are not instrumented/reported as visited HOT 14
- Don't suppress TRMC optimization
- Consider an optional deuteranopia-friendly theme HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bisect_ppx.