Skip to content

Commit

Permalink
Add abort to autoload functions (#5)
Browse files Browse the repository at this point in the history
[See Vint linting
policy()]https://github.com/Kuniwak/vint/wiki/Vint-linting-policy-summar
y)

*`abort` forces the function to halt when it encounters an error.*

Add `abort` to autoload functions

[See Vint linting
policy()]https://github.com/Kuniwak/vint/wiki/Vint-linting-policy-summar
y)

*`abort` forces the function to halt when it encounters an error.*
  • Loading branch information
alok authored and sbdchd committed Dec 4, 2016
1 parent 8a4d978 commit 53d6bad
Show file tree
Hide file tree
Showing 41 changed files with 112 additions and 114 deletions.
2 changes: 0 additions & 2 deletions .vintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ policies:
enabled: false
ProhibitEqualTildeOperator:
enabled: false
ProhibitNoAbortFunction:
enabled: false
8 changes: 4 additions & 4 deletions autoload/neoformat.vim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function! neoformat#Start(user_formatter)
function! neoformat#Start(user_formatter) abort
let s:current_formatter_index = 0
call neoformat#Neoformat(a:user_formatter)
endfunction
Expand Down Expand Up @@ -60,7 +60,7 @@ function! s:get_enabled_formatters(filetype) abort
return []
endfunction

function! neoformat#CompleteFormatters(ArgLead, CmdLine, CursorPos)
function! neoformat#CompleteFormatters(ArgLead, CmdLine, CursorPos) abort
if a:ArgLead =~ '[^A-Za-z0-9]'
return []
endif
Expand All @@ -75,7 +75,7 @@ function! neoformat#NextNeoformat() abort
return neoformat#Neoformat('')
endfunction

function! s:autoload_func_exists(func_name)
function! s:autoload_func_exists(func_name) abort
try
call eval(a:func_name . '()')
catch /^Vim\%((\a\+)\)\=:E117/
Expand All @@ -84,7 +84,7 @@ function! s:autoload_func_exists(func_name)
return 1
endfunction

function! s:split_filetypes(filetype)
function! s:split_filetypes(filetype) abort
if a:filetype == ''
return ''
endif
Expand Down
8 changes: 4 additions & 4 deletions autoload/neoformat/formatters/arduino.vim
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
function! neoformat#formatters#arduino#enabled()
function! neoformat#formatters#arduino#enabled() abort
return ['uncrustify', 'clangformat', 'astyle']
endfunction

function! neoformat#formatters#arduino#uncrustify()
function! neoformat#formatters#arduino#uncrustify() abort
return neoformat#formatters#cpp#uncrustify()
endfunction

function! neoformat#formatters#arduino#clangformat()
function! neoformat#formatters#arduino#clangformat() abort
return neoformat#formatters#c#clangformat()
endfunction

function! neoformat#formatters#arduino#astyle()
function! neoformat#formatters#arduino#astyle() abort
return neoformat#formatters#c#astyle()
endfunction
8 changes: 4 additions & 4 deletions autoload/neoformat/formatters/c.vim
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
function! neoformat#formatters#c#enabled()
function! neoformat#formatters#c#enabled() abort
return ['uncrustify', 'clangformat', 'astyle']
endfunction

function! neoformat#formatters#c#uncrustify()
function! neoformat#formatters#c#uncrustify() abort
return {
\ 'exe': 'uncrustify',
\ 'args': ['-q', '-l C', '-f']
\ }
endfunction

function! neoformat#formatters#c#clangformat()
function! neoformat#formatters#c#clangformat() abort
return {'exe': 'clang-format'}
endfunction

function! neoformat#formatters#c#astyle()
function! neoformat#formatters#c#astyle() abort
return {
\ 'exe': 'astyle',
\ 'args': ['--mode=c'],
Expand Down
8 changes: 4 additions & 4 deletions autoload/neoformat/formatters/cpp.vim
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
function! neoformat#formatters#cpp#enabled()
function! neoformat#formatters#cpp#enabled() abort
return ['uncrustify', 'clangformat', 'astyle']
endfunction

function! neoformat#formatters#cpp#uncrustify()
function! neoformat#formatters#cpp#uncrustify() abort
return {
\ 'exe': 'uncrustify',
\ 'args': ['-q', '-l CPP', '-f']
\ }
endfunction

function! neoformat#formatters#cpp#clangformat()
function! neoformat#formatters#cpp#clangformat() abort
return neoformat#formatters#c#clangformat()
endfunction

function! neoformat#formatters#cpp#astyle()
function! neoformat#formatters#cpp#astyle() abort
return neoformat#formatters#c#astyle()
endfunction

4 changes: 2 additions & 2 deletions autoload/neoformat/formatters/crystal.vim
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function! neoformat#formatters#crystal#enabled()
function! neoformat#formatters#crystal#enabled() abort
return ['crystalformat']
endfunction

function! neoformat#formatters#crystal#crystalformat()
function! neoformat#formatters#crystal#crystalformat() abort
return {
\ 'exe': 'crystal',
\ 'args': ['tool', 'format'],
Expand Down
6 changes: 3 additions & 3 deletions autoload/neoformat/formatters/cs.vim
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
function! neoformat#formatters#cs#enabled()
function! neoformat#formatters#cs#enabled() abort
return ['uncrustify', 'astyle']
endfunction

function! neoformat#formatters#cs#uncrustify()
function! neoformat#formatters#cs#uncrustify() abort
return {
\ 'exe': 'uncrustify',
\ 'args': ['-q', '-l CS', '-f']
\ }
endfunction

function! neoformat#formatters#cs#astyle()
function! neoformat#formatters#cs#astyle() abort
return {
\ 'exe': 'astyle',
\ 'args': ['--mode=cs'],
Expand Down
10 changes: 5 additions & 5 deletions autoload/neoformat/formatters/css.vim
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
function! neoformat#formatters#css#enabled()
function! neoformat#formatters#css#enabled() abort
return ['cssbeautify', 'prettydiff', 'stylefmt', 'csscomb']
endfunction

function! neoformat#formatters#css#cssbeautify()
function! neoformat#formatters#css#cssbeautify() abort
return { 'exe': 'css-beautify' }
endfunction

function! neoformat#formatters#css#csscomb()
function! neoformat#formatters#css#csscomb() abort
return {
\ 'exe': 'csscomb',
\ 'replace': 1
\ }
endfunction

function! neoformat#formatters#css#prettydiff()
function! neoformat#formatters#css#prettydiff() abort
return {
\ 'exe': 'prettydiff',
\ 'args': ['mode:"beautify"',
Expand All @@ -25,7 +25,7 @@ function! neoformat#formatters#css#prettydiff()
\ }
endfunction

function! neoformat#formatters#css#stylefmt()
function! neoformat#formatters#css#stylefmt() abort
return {
\ 'exe': 'stylefmt',
\ 'replace': 1
Expand Down
4 changes: 2 additions & 2 deletions autoload/neoformat/formatters/csv.vim
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function! neoformat#formatters#csv#enabled()
function! neoformat#formatters#csv#enabled() abort
return ['prettydiff']
endfunction

function! neoformat#formatters#csv#prettydiff()
function! neoformat#formatters#csv#prettydiff() abort
return {
\ 'exe': 'prettydiff',
\ 'args': ['mode:"beautify"',
Expand Down
6 changes: 3 additions & 3 deletions autoload/neoformat/formatters/d.vim
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
function! neoformat#formatters#d#enabled()
function! neoformat#formatters#d#enabled() abort
return ['uncrustify', 'dfmt']
endfunction

function! neoformat#formatters#d#dfmt()
function! neoformat#formatters#d#dfmt() abort
return {
\ 'exe': 'dfmt'
\ }
endfunction

function! neoformat#formatters#d#uncrustify()
function! neoformat#formatters#d#uncrustify() abort
return {
\ 'exe': 'uncrustify',
\ 'args': ['-q', '-l D', '-f']
Expand Down
4 changes: 2 additions & 2 deletions autoload/neoformat/formatters/dart.vim
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function! neoformat#formatters#dart#enabled()
function! neoformat#formatters#dart#enabled() abort
return ['dartfmt']
endfunction

function! neoformat#formatters#dart#dartfmt()
function! neoformat#formatters#dart#dartfmt() abort
return {
\ 'exe': 'dartfmt',
\ }
Expand Down
4 changes: 2 additions & 2 deletions autoload/neoformat/formatters/elm.vim
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function! neoformat#formatters#elm#enabled()
function! neoformat#formatters#elm#enabled() abort
return ['elmformat']
endfunction

function! neoformat#formatters#elm#elmformat()
function! neoformat#formatters#elm#elmformat() abort
return {
\ 'exe': 'elm-format'
\ }
Expand Down
6 changes: 3 additions & 3 deletions autoload/neoformat/formatters/go.vim
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
function! neoformat#formatters#go#enabled()
function! neoformat#formatters#go#enabled() abort
return ['goimports', 'gofmt']
endfunction

function! neoformat#formatters#go#gofmt()
function! neoformat#formatters#go#gofmt() abort
return {'exe': 'gofmt'}
endfunction

function! neoformat#formatters#go#goimports()
function! neoformat#formatters#go#goimports() abort
return {'exe': 'goimports'}
endfunction

4 changes: 2 additions & 2 deletions autoload/neoformat/formatters/haskell.vim
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function! neoformat#formatters#haskell#enabled()
function! neoformat#formatters#haskell#enabled() abort
return ['stylishhaskell']
endfunction

function! neoformat#formatters#haskell#stylishhaskell()
function! neoformat#formatters#haskell#stylishhaskell() abort
return {
\ 'exe': 'stylish-haskell'
\ }
Expand Down
8 changes: 4 additions & 4 deletions autoload/neoformat/formatters/html.vim
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function! neoformat#formatters#html#enabled()
function! neoformat#formatters#html#enabled() abort
return ['htmlbeautify', 'tidy', 'prettydiff']
endfunction

function! neoformat#formatters#html#tidy()
function! neoformat#formatters#html#tidy() abort
return {
\ 'exe': 'tidy',
\ 'args': ['-quiet',
Expand All @@ -14,11 +14,11 @@ function! neoformat#formatters#html#tidy()
\ }
endfunction

function! neoformat#formatters#html#htmlbeautify()
function! neoformat#formatters#html#htmlbeautify() abort
return {'exe': 'html-beautify'}
endfunction

function! neoformat#formatters#html#prettydiff()
function! neoformat#formatters#html#prettydiff() abort
return {
\ 'exe': 'prettydiff',
\ 'args': ['mode:"beautify"',
Expand Down
4 changes: 2 additions & 2 deletions autoload/neoformat/formatters/jade.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function! neoformat#formatters#jade#enabled()
function! neoformat#formatters#jade#enabled() abort
return ['pugbeautifier']
endfunction

function! neoformat#formatters#jade#pugbeautifier()
function! neoformat#formatters#jade#pugbeautifier() abort
return neoformat#formatters#pug#pugbeautifier()
endfunction
8 changes: 4 additions & 4 deletions autoload/neoformat/formatters/java.vim
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
function! neoformat#formatters#java#enabled()
function! neoformat#formatters#java#enabled() abort
return ['uncrustify', 'astyle', 'clang-format']
endfunction

function! neoformat#formatters#java#uncrustify()
function! neoformat#formatters#java#uncrustify() abort
return {
\ 'exe': 'uncrustify',
\ 'args': ['-q', '-l JAVA', '-f']
\ }
endfunction


function! neoformat#formatters#java#astyle()
function! neoformat#formatters#java#astyle() abort
return {
\ 'exe': 'astyle',
\ 'args': ['--mode=java'],
Expand All @@ -19,7 +19,7 @@ function! neoformat#formatters#java#astyle()
endfunction


function! neoformat#formatters#java#clangformat()
function! neoformat#formatters#java#clangformat() abort
return {'exe': 'clang-format'}
endfunction

Expand Down
10 changes: 5 additions & 5 deletions autoload/neoformat/formatters/javascript.vim
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
function! neoformat#formatters#javascript#enabled()
function! neoformat#formatters#javascript#enabled() abort
return ['jsbeautify', 'prettydiff', 'clangformat', 'esformatter']
endfunction

function! neoformat#formatters#javascript#jsbeautify()
function! neoformat#formatters#javascript#jsbeautify() abort
return {'exe': 'js-beautify'}
endfunction

function! neoformat#formatters#javascript#clangformat()
function! neoformat#formatters#javascript#clangformat() abort
return {'exe': 'clang-format'}
endfunction

function! neoformat#formatters#javascript#prettydiff()
function! neoformat#formatters#javascript#prettydiff() abort
return {
\ 'exe': 'prettydiff',
\ 'args': ['mode:"beautify"',
Expand All @@ -22,7 +22,7 @@ function! neoformat#formatters#javascript#prettydiff()
\ }
endfunction

function! neoformat#formatters#javascript#esformatter()
function! neoformat#formatters#javascript#esformatter() abort
return {
\ 'exe': 'esformatter'
\ }
Expand Down
6 changes: 3 additions & 3 deletions autoload/neoformat/formatters/jinja.vim
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
function! neoformat#formatters#jinja#enabled()
function! neoformat#formatters#jinja#enabled() abort
return ['prettydiff', 'htmlbeautify']
endfunction

function! neoformat#formatters#jinja#htmlbeautify()
function! neoformat#formatters#jinja#htmlbeautify() abort
return neoformat#formatters#html#htmlbeautify()
endfunction

function! neoformat#formatters#jinja#prettydiff()
function! neoformat#formatters#jinja#prettydiff() abort
return neoformat#formatters#html#prettydiff()
endfunction
6 changes: 3 additions & 3 deletions autoload/neoformat/formatters/json.vim
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
function! neoformat#formatters#json#enabled()
function! neoformat#formatters#json#enabled() abort
return ['jsbeautify', 'prettydiff']
endfunction

function! neoformat#formatters#json#jsbeautify()
function! neoformat#formatters#json#jsbeautify() abort
return neoformat#javascript#jsbeautify()
endfunction

function! neoformat#formatters#json#prettydiff()
function! neoformat#formatters#json#prettydiff() abort
return neoformat#javascript#prettydiff()
endfunction
6 changes: 3 additions & 3 deletions autoload/neoformat/formatters/less.vim
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
function! neoformat#formatters#less#enabled()
function! neoformat#formatters#less#enabled() abort
return ['csscomb', 'prettydiff']
endfunction

function! neoformat#formatters#less#csscomb()
function! neoformat#formatters#less#csscomb() abort
return neoformat#formatters#css#csscomb()
endfunction

function! neoformat#formatters#less#prettydiff()
function! neoformat#formatters#less#prettydiff() abort
return neoformat#formatters#css#prettydiff()
endfunction
4 changes: 2 additions & 2 deletions autoload/neoformat/formatters/lua.vim
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function! neoformat#formatters#lua#enabled()
function! neoformat#formatters#lua#enabled() abort
return ['luaformatter']
endfunction

function! neoformat#formatters#lua#luaformatter()
function! neoformat#formatters#lua#luaformatter() abort
return {
\ 'exe': 'luaformatter'
\ }
Expand Down
Loading

0 comments on commit 53d6bad

Please sign in to comment.