|
3 | 3 |
|
4 | 4 | -export([ |
5 | 5 | incls_deps_opts/1, |
6 | | - print_issues/2, |
| 6 | + print_issues/3, |
7 | 7 | consult_file/1 |
8 | 8 | ]). |
9 | 9 |
|
@@ -134,18 +134,16 @@ deps_opts(BaseDir, OtpStdDirs, ErlcStdOpts, Profile) -> |
134 | 134 | UniqErlcOpts = uniq(ErlcStdOpts ++ ErlcOpts), |
135 | 135 | {UniqDepsDirs, UniqErlcOpts}. |
136 | 136 |
|
137 | | --spec print_issues(FileName::file:filename(), Issues::[issue()]) -> ok. |
138 | | -print_issues(_FileName, []) -> |
139 | | - ok; |
140 | | -print_issues(FileName, [Issue | Issues]) -> |
141 | | - print_issue(FileName, Issue), |
142 | | - print_issues(FileName, Issues). |
| 137 | +-spec print_issues(FileName::file:filename(), BaseFileName::file:filename(), Issues::[issue()]) -> ok. |
| 138 | +print_issues(OrigFileName, BaseFileName, List) -> |
| 139 | + List0 = fix_file_names(OrigFileName, BaseFileName, List), |
| 140 | + lists:foreach(fun print_issue/1, List0). |
143 | 141 |
|
144 | | -print_issue(FileName, {warning, Line, Description}) -> |
| 142 | +print_issue({warning, FileName, Line, Description}) -> |
145 | 143 | io:format("~s:~p: warning: ~s~n", [FileName, Line, Description]); |
146 | | -print_issue(FileName, {error, Description}) -> |
| 144 | +print_issue({error, FileName, Description}) -> |
147 | 145 | io:format("~s:~s~n", [FileName, Description]); |
148 | | -print_issue(FileName, {error, Line, Description}) -> |
| 146 | +print_issue({error, FileName, Line, Description}) -> |
149 | 147 | io:format("~s:~p: ~s~n", [FileName, Line, Description]). |
150 | 148 |
|
151 | 149 | -spec consult_file(file:filename()) -> {ok, term()} | {error, error()}. |
@@ -443,6 +441,14 @@ try_consult(File) -> |
443 | 441 | syntaxerl_logger:debug(true, "Failed to read config file ~s: ~p~n", [File, Reason]) |
444 | 442 | end. |
445 | 443 |
|
| 444 | +fix_file_names(FileName, BaseFileName, ErrorList) -> |
| 445 | + [fix_file_name(FileName, BaseFileName, Error) || Error <- ErrorList]. |
| 446 | + |
| 447 | +fix_file_name(FileName, BaseFileName, {Type, FileName, Line, Description}) -> |
| 448 | + {Type, BaseFileName, Line, Description}; |
| 449 | +fix_file_name(_TmpFileName, _FileName, Issue) -> |
| 450 | + Issue. |
| 451 | + |
446 | 452 | bs(Vars) -> |
447 | 453 | lists:foldl(fun({K,V}, Bs) -> |
448 | 454 | erl_eval:add_binding(K, V, Bs) |
|
0 commit comments