Minor cleanup: replace match() by stridx() when appropriate.
This commit is contained in:
parent
0714044f98
commit
fa2e6b96d9
@ -44,7 +44,7 @@ function! SyntaxCheckers_go_go_GetLocList() dict
|
||||
|
||||
" Test files, i.e. files with a name ending in `_test.go`, are not
|
||||
" compiled by `go build`, therefore `go test` must be called for those.
|
||||
if match(expand('%'), '_test.go$') == -1
|
||||
if match(expand('%'), '\m_test\.go$') == -1
|
||||
let makeprg = 'go build ' . syntastic#c#NullOutput()
|
||||
else
|
||||
let makeprg = 'go test -c ' . syntastic#c#NullOutput()
|
||||
|
@ -206,7 +206,7 @@ function! s:GetMavenClasspath()
|
||||
let mvn_classpath = s:RemoveCarriageReturn(line)
|
||||
break
|
||||
endif
|
||||
if match(line,'Dependencies classpath:') >= 0
|
||||
if stridx(line,'Dependencies classpath:') >= 0
|
||||
let class_path_next = 1
|
||||
endif
|
||||
endfor
|
||||
@ -246,13 +246,13 @@ function! s:MavenOutputDirectory()
|
||||
if has_key(mvn_properties, 'project.properties.build.dir')
|
||||
let output_dir = mvn_properties['project.properties.build.dir']
|
||||
endif
|
||||
if match(expand( '%:p:h' ), "src.main.java") >= 0
|
||||
if stridx(expand( '%:p:h' ), "src.main.java") >= 0
|
||||
let output_dir .= '/target/classes'
|
||||
if has_key(mvn_properties, 'project.build.outputDirectory')
|
||||
let output_dir = mvn_properties['project.build.outputDirectory']
|
||||
endif
|
||||
endif
|
||||
if match(expand( '%:p:h' ), "src.test.java") >= 0
|
||||
if stridx(expand( '%:p:h' ), "src.test.java") >= 0
|
||||
let output_dir .= '/target/test-classes'
|
||||
if has_key(mvn_properties, 'project.build.testOutputDirectory')
|
||||
let output_dir = mvn_properties['project.build.testOutputDirectory']
|
||||
|
@ -131,10 +131,10 @@ function! s:GetOtherMakeprg()
|
||||
let extension = expand('%:e')
|
||||
let makeprg = ""
|
||||
|
||||
if match(extension, 'mly') >= 0 && executable("menhir")
|
||||
if stridx(extension, 'mly') >= 0 && executable("menhir")
|
||||
" ocamlyacc output can't be redirected, so use menhir
|
||||
let makeprg = "menhir --only-preprocess " . syntastic#util#shexpand('%') . " >" . syntastic#util#DevNull()
|
||||
elseif match(extension,'mll') >= 0 && executable("ocamllex")
|
||||
elseif stridx(extension,'mll') >= 0 && executable("ocamllex")
|
||||
let makeprg = "ocamllex -q " . syntastic#c#NullOutput() . " " . syntastic#util#shexpand('%')
|
||||
else
|
||||
let makeprg = "camlp4o " . syntastic#c#NullOutput() . " " . syntastic#util#shexpand('%')
|
||||
|
@ -9,17 +9,17 @@
|
||||
if exists("g:loaded_syntastic_python_pyflakes_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_python_pyflakes_checker=1
|
||||
let g:loaded_syntastic_python_pyflakes_checker = 1
|
||||
|
||||
function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i)
|
||||
if match(a:i['text'], 'is assigned to but never used') > -1
|
||||
\ || match(a:i['text'], 'imported but unused') > -1
|
||||
\ || match(a:i['text'], 'undefined name') > -1
|
||||
\ || match(a:i['text'], 'redefinition of') > -1
|
||||
\ || match(a:i['text'], 'referenced before assignment') > -1
|
||||
\ || match(a:i['text'], 'duplicate argument') > -1
|
||||
\ || match(a:i['text'], 'after other statements') > -1
|
||||
\ || match(a:i['text'], 'shadowed by loop variable') > -1
|
||||
if stridx(a:i['text'], 'is assigned to but never used') >= 0
|
||||
\ || stridx(a:i['text'], 'imported but unused') >= 0
|
||||
\ || stridx(a:i['text'], 'undefined name') >= 0
|
||||
\ || stridx(a:i['text'], 'redefinition of') >= 0
|
||||
\ || stridx(a:i['text'], 'referenced before assignment') >= 0
|
||||
\ || stridx(a:i['text'], 'duplicate argument') >= 0
|
||||
\ || stridx(a:i['text'], 'after other statements') >= 0
|
||||
\ || stridx(a:i['text'], 'shadowed by loop variable') >= 0
|
||||
|
||||
" fun with Python's %r: try "..." first, then '...'
|
||||
let terms = split(a:i['text'], '"', 1)
|
||||
|
@ -20,7 +20,7 @@ if !exists("g:syntastic_ruby_exec")
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i)
|
||||
if match(a:i['text'], 'assigned but unused variable') > -1
|
||||
if stridx(a:i['text'], 'assigned but unused variable') >= 0
|
||||
let term = split(a:i['text'], ' - ')[1]
|
||||
return '\V\<'.term.'\>'
|
||||
endif
|
||||
|
@ -20,11 +20,11 @@ function! s:GetShell()
|
||||
let b:shell = ''
|
||||
let shebang = getbufline(bufnr('%'), 1)[0]
|
||||
if len(shebang) > 0
|
||||
if match(shebang, 'bash') >= 0
|
||||
if stridx(shebang, 'bash') >= 0
|
||||
let b:shell = 'bash'
|
||||
elseif match(shebang, 'zsh') >= 0
|
||||
elseif stridx(shebang, 'zsh') >= 0
|
||||
let b:shell = 'zsh'
|
||||
elseif match(shebang, 'sh') >= 0
|
||||
elseif stridx(shebang, 'sh') >= 0
|
||||
let b:shell = 'sh'
|
||||
endif
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user