Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows compatible warning match pattern for erlc #1071

Merged
merged 2 commits into from Nov 3, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions ale_linters/erlang/erlc.vim
Expand Up @@ -17,7 +17,7 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
" error.erl:4: variable 'B' is unbound
" error.erl:3: Warning: function main/0 is unused
" error.erl:4: Warning: variable 'A' is unused
let l:pattern = '\v^([^:]+):(\d+): (Warning: )?(.+)$'
let l:pattern = '\v\C:(\d+): (Warning: )?(.+)$'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder, can erlc return the names of other included files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it is possible in theory.
Due to how erlc is used in the checker with a temp file, this is unlikely (and causes unwanted errors, such as printing warnings about undefined behaviors when using user defined behaviors).

We could modify the pattern to enable extracting the file name, for instance starting the pattern with \v^([a-zA-Z]?:?[^:]+) instead of \v^([^:]+).
This way we keep the ability to use the file name in the future.


" parse_transforms are a special case. The error message does not indicate a location:
" error.erl: undefined parse transform 'some_parse_transform'
Expand Down Expand Up @@ -56,9 +56,9 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
continue
endif

let l:line = l:match[2]
let l:warning_or_text = l:match[3]
let l:text = l:match[4]
let l:line = l:match[1]
let l:warning_or_text = l:match[2]
let l:text = l:match[3]

" If this file is a header .hrl, ignore the following expected messages:
" - 'no module definition'
Expand Down