From cac7fd3698896b24e7c62bfc7b8fbe175866c3e5 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Fri, 27 Oct 2017 09:03:28 +0300 Subject: [PATCH] New checker for Solidity: solhint. --- doc/syntastic-checkers.txt | 23 +++++++++++++++ plugin/syntastic.vim | 2 +- syntax_checkers/solidity/solhint.vim | 43 ++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 syntax_checkers/solidity/solhint.vim diff --git a/doc/syntastic-checkers.txt b/doc/syntastic-checkers.txt index 22f4a964..314e7e23 100644 --- a/doc/syntastic-checkers.txt +++ b/doc/syntastic-checkers.txt @@ -6305,6 +6305,7 @@ The following checkers are available for Solidity (filetype "solidity"): 1. solc.....................|syntastic-solidity-solc| 2. Solium...................|syntastic-solidity-solium| + 3. Solhint..................|syntastic-solidity-solhint| ------------------------------------------------------------------------------ 1. solc *syntastic-solidity-solc* @@ -6346,6 +6347,28 @@ accepts the standard options described at |syntastic-config-makeprg|. Note~ +You probably also need a plugin to set |filetype| for Solidity files, such as +"vim-solidity": + + https://github.com/tomlion/vim-solidity + +------------------------------------------------------------------------------ +2. Solium *syntastic-solidity-solium* + +Name: solhint +Maintainer: Brett Sun + +"Solhint" is a linter for "Solidity" files. See the project's page for details: + + https://github.com/protofire/solhint + +Checker options~ + +This checker is initialised using the "makeprgBuild()" function and thus it +accepts the standard options described at |syntastic-config-makeprg|. + +Note~ + You probably also need a plugin to set |filetype| for Solidity files, such as "vim-solidity": diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index f055e66d..d0701774 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.8.0-88' +let g:_SYNTASTIC_VERSION = '3.8.0-89' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 diff --git a/syntax_checkers/solidity/solhint.vim b/syntax_checkers/solidity/solhint.vim new file mode 100644 index 00000000..55611194 --- /dev/null +++ b/syntax_checkers/solidity/solhint.vim @@ -0,0 +1,43 @@ +"============================================================================ +"File: solhint.vim +"Description: Solidity syntax checker - using solhint +"Maintainer: Brett Sun +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists('g:loaded_syntastic_solidity_solhint_checker') + finish +endif +let g:loaded_syntastic_solidity_solhint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_solidity_solhint_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'args_after': '-f compact' }) + + let errorformat = + \ '%E%f: line %l\, col %c\, Error - %m,' . + \ '%W%f: line %l\, col %c\, Warning - %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style', + \ 'returns': [0, 1] }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'solidity', + \ 'name': 'solhint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: