[erlang-patches] Fix searching for source files in cover:analyse_to_file/*

Björn Gustavsson <>
Sat Apr 24 09:26:50 CEST 2010


On Fri, Apr 23, 2010 at 10:56 PM, Jeremy Raymond <> wrote:
> I've patched cover to search for source files in the location referenced in
> the .beam file instead of just in the .beam directory and in the ../src
> relative dir. This is based upon a patch by Thomas Arts posted to
> erlang-questions several years ago that never made it into otp (
> http://www.erlang.org/cgi-bin/ezmlm-cgi/4/29048).
>
> git fetch git://github.com/jeraymond/otp.git cover_src_path_fix

Thanks!

Your patch removes the export of three documented functions. Why?

The code itself is easy to follow and looks reasonable (and the test
suite has been updated!), but the spacing is inconsistent both in the
code itself and compared to the rest of the module. There should a
space after commas in function calls, and spaces around list
comprehension generators (" <- "), but list matching
should be written without spaces like "[Main|_]".

Also, "_" variables in the last clause of a case should be avoided
if the value is known. So it should be:

case filelib:is_file(Main) of
    true ->
         ...;
    false ->
         ...
end.

and so on for all the other "_" variables.

I would also recommend that path_in_beam simply returns
'error' instead of an error tuple whose value is never used.

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB


More information about the erlang-patches mailing list