Gradualizer icon indicating copy to clipboard operation
Gradualizer copied to clipboard

Error output format

Open galdor opened this issue 4 years ago • 2 comments

In the current state, errors are reported with lines such as:

<absolute-path>: The <element> on line <line-number> at column <column-number> […]
  1. The path should be relative to the current directory, this way it would be way shorter and easier to read.
  2. The format should use the usual convention:
    <relative-path>:<line-number>:<column-number>: […]
    
    This would be both easier to read, and would make it possible to use Gradualizer with tools that work with this kind of output , such as compilation-mode in Emacs.

galdor avatar Mar 12 '21 06:03 galdor

If you feed it erl files, I think it prints the paths you feed it with, but when you feed it beam files, it takes the erl path from within the AST stored inside the beam. I think rebar3 feeds an absolute path to the compiler. In OTP modules, the paths are relative the application directory IIRC. Do you have an idea how we can get the relative path back in a consistent way?

Regarding :line:column, there are flags/options for this. Instead of taking a decision, we added a lot of options. :) (Personally, I think we should keep only the :line:column form and drop the current default form.)

zuiderkwast avatar Mar 12 '21 09:03 zuiderkwast

I'm using the Rebar3 plugin. I had this problem in the past with data coming from Rebar3 in general, and the only way to do it properly is to get the current path and use it to compute a relative path while being careful with ., .. and symbolic links. Of course this should be done in Rebar3…

Regarding options, it seems they can be set with the Rebar3 plugin with gradualizer_opts, I'll give it a try. Thanks! And indeed, this should be the default.

galdor avatar Mar 12 '21 11:03 galdor