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

Conversation

selliera
Copy link
Contributor

The pattern did search for lines starting with ([^:]+) as the filename,
however under windows, the file name erlc ouputs is like:
c:/Users/user/AppData/Local/Temp/XXX.tmp/file.erl
Simplifying the patters as it is done for the syntaxerl checker avoids
the issue.

I haven't found tests for this part, and I'm not proficient enough in vader to add a new one from scratch, but I can work on it provided some guidance.

The pattern did search for lines starting with ([^:]+) as the filename,
however under windows, the file name erlc ouputs is like:
c:/Users/user/AppData/Local/Temp/XXX.tmp/file.erl
Simplifying the patters as it is done for the syntaxerl checker avoids
the issue.
@@ -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.

enable windows file names in the erlc pattern
Copy link
Member

@w0rp w0rp left a comment

Choose a reason for hiding this comment

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

That looks good. The filename could be useful in future.

@w0rp w0rp merged commit 54f44c2 into dense-analysis:master Nov 3, 2017
w0rp pushed a commit that referenced this pull request Nov 3, 2017
* windows compatible warning match pattern for erlc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants