All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: Karl Bartel <karl42@gmail.com> - http://karl.berlin/
2 " Description: Report solc compiler errors in Solidity code
4 call ale#Set('solidity_solc_executable', 'solc')
5 call ale#Set('solidity_solc_options', '')
7 function! ale_linters#solidity#solc#Handle(buffer, lines) abort
8 " Matches patterns like the following:
9 " Error: Expected ';' but got '('
10 " --> /path/to/file/file.sol:1:10:)
11 let l:pattern = '\v(Error|Warning): (.*)$'
12 let l:line_and_column_pattern = '\v\.sol:(\d+):(\d+):'
16 let l:match = matchlist(l:line, l:pattern)
19 let l:match = matchlist(l:line, l:line_and_column_pattern)
22 let l:index = len(l:output) - 1
23 let l:output[l:index]['lnum'] = l:match[1] + 0
24 let l:output[l:index]['col'] = l:match[2] + 0
27 let l:isError = l:match[1] is? 'Error'
33 \ 'type': l:isError ? 'E' : 'W',
41 function! ale_linters#solidity#solc#GetCommand(buffer) abort
42 let l:executable = ale#Var(a:buffer, 'solidity_solc_executable')
44 return l:executable . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s'
47 call ale#linter#Define('solidity', {
49 \ 'executable': {b -> ale#Var(b, 'solidity_solc_executable')},
50 \ 'command': function('ale_linters#solidity#solc#GetCommand'),
51 \ 'callback': 'ale_linters#solidity#solc#Handle',
52 \ 'output_stream': 'stderr',