mirror of
https://github.com/amix/vimrc
synced 2025-07-09 18:55:01 +08:00
gitignore sources_non_forked_cache
This commit is contained in:
53
sources_non_forked/ale/ale_linters/solidity/solc.vim
Normal file
53
sources_non_forked/ale/ale_linters/solidity/solc.vim
Normal file
@ -0,0 +1,53 @@
|
||||
" Author: Karl Bartel <karl42@gmail.com> - http://karl.berlin/
|
||||
" Description: Report solc compiler errors in Solidity code
|
||||
|
||||
call ale#Set('solidity_solc_executable', 'solc')
|
||||
call ale#Set('solidity_solc_options', '')
|
||||
|
||||
function! ale_linters#solidity#solc#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" Error: Expected ';' but got '('
|
||||
" --> /path/to/file/file.sol:1:10:)
|
||||
let l:pattern = '\v(Error|Warning): (.*)$'
|
||||
let l:line_and_column_pattern = '\v\.sol:(\d+):(\d+):'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
let l:match = matchlist(l:line, l:line_and_column_pattern)
|
||||
|
||||
if len(l:match) > 0
|
||||
let l:index = len(l:output) - 1
|
||||
let l:output[l:index]['lnum'] = l:match[1] + 0
|
||||
let l:output[l:index]['col'] = l:match[2] + 0
|
||||
endif
|
||||
else
|
||||
let l:isError = l:match[1] is? 'Error'
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'type': l:isError ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#solidity#solc#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'solidity_solc_executable')
|
||||
|
||||
return l:executable . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('solidity', {
|
||||
\ 'name': 'solc',
|
||||
\ 'executable': {b -> ale#Var(b, 'solidity_solc_executable')},
|
||||
\ 'command': function('ale_linters#solidity#solc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#solidity#solc#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
12
sources_non_forked/ale/ale_linters/solidity/solhint.vim
Normal file
12
sources_non_forked/ale/ale_linters/solidity/solhint.vim
Normal file
@ -0,0 +1,12 @@
|
||||
" Authors: Franco Victorio - https://github.com/fvictorio, Henrique Barcelos
|
||||
" https://github.com/hbarcelos
|
||||
" Description: Report errors in Solidity code with solhint
|
||||
|
||||
call ale#linter#Define('solidity', {
|
||||
\ 'name': 'solhint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#handlers#solhint#GetExecutable'),
|
||||
\ 'cwd': function('ale#handlers#solhint#GetCwd'),
|
||||
\ 'command': function('ale#handlers#solhint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#solhint#Handle',
|
||||
\})
|
9
sources_non_forked/ale/ale_linters/solidity/solium.vim
Normal file
9
sources_non_forked/ale/ale_linters/solidity/solium.vim
Normal file
@ -0,0 +1,9 @@
|
||||
" Author: Jeff Sutherland - https://github.com/jdsutherland
|
||||
" Description: Report errors in Solidity code with solium
|
||||
|
||||
call ale#linter#Define('solidity', {
|
||||
\ 'name': 'solium',
|
||||
\ 'executable': 'solium',
|
||||
\ 'command': 'solium --reporter gcc --file %t',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
Reference in New Issue
Block a user