dashbitco / nimble_csv

A simple and fast CSV parsing and dumping library for Elixir
https://hexdocs.pm/nimble_csv
767 stars 51 forks source link

Generated beam files contain absolute path for nimble_csv.ex #42

Closed TheFirstAvenger closed 5 years ago

TheFirstAvenger commented 5 years ago

When a parser is defined in an umbrella app, the generated beam files contain an absolute reference to the nimble_csv.ex file inside the deps/nimble_csv folder. This is causing that absolute file path to be picked up in test coverage and coveralls reports.

Elixir:

  NimbleCSV.define(MyChildApp.Parsers.TsvParser, separator: "\t", escape: "\"")

Disassembled beam:

//Function  Elixir.MyChildApp.Parsers.TsvParser:dump/2
label007:  func_info            Elixir.MyChildApp.Parsers.TsvParser dump 2 //line /Users/binns/git/my_umbrella_app/deps/nimble_csv/lib/nimble_csv.ex, 458

mix test --cover output:

COV    FILE                                        LINES RELEVANT   MISSED
 42.1% /Users/binns/git/my_umbrella_app/deps/nimb      494       38       22
  0.0% lib/my_child_app.ex                                18        0        0
josevalim commented 5 years ago

I don't think there is anything we can do. Elixir generate paths relative to the project but because the deps folder is one level higher, we can't compute it.

My suggestion is to actually ignore this file based on the "lib/nimble_csv.ex" extension (as it doesn't make sense to check the coverage of code generated for you).

josevalim commented 5 years ago

I dno't think