Move path functions to their own file
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
" Description: Coffee for checking coffee files
|
||||
|
||||
function! ale_linters#coffee#coffee#GetExecutable(buffer) abort
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/coffee',
|
||||
\ 'coffee'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
" Description: coffeelint linter for coffeescript files
|
||||
|
||||
function! ale_linters#coffee#coffeelint#GetExecutable(buffer) abort
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/coffeelint',
|
||||
\ 'coffeelint'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
" Description: This file adds support for checking CSS code with csslint.
|
||||
|
||||
function! ale_linters#css#csslint#GetCommand(buffer) abort
|
||||
let l:csslintrc = ale#util#FindNearestFile(a:buffer, '.csslintrc')
|
||||
let l:csslintrc = ale#path#FindNearestFile(a:buffer, '.csslintrc')
|
||||
let l:config_option = !empty(l:csslintrc)
|
||||
\ ? '--config=' . fnameescape(l:csslintrc)
|
||||
\ : ''
|
||||
|
||||
@@ -14,7 +14,7 @@ function! ale_linters#css#stylelint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'css_stylelint_executable')
|
||||
endif
|
||||
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ale#Var(a:buffer, 'css_stylelint_executable')
|
||||
|
||||
@@ -5,7 +5,7 @@ function! s:FindDUBConfig(buffer) abort
|
||||
" Find a DUB configuration file in ancestor paths.
|
||||
" The most DUB-specific names will be tried first.
|
||||
for l:possible_filename in ['dub.sdl', 'dub.json', 'package.json']
|
||||
let l:dub_file = ale#util#FindNearestFile(a:buffer, l:possible_filename)
|
||||
let l:dub_file = ale#path#FindNearestFile(a:buffer, l:possible_filename)
|
||||
|
||||
if !empty(l:dub_file)
|
||||
return l:dub_file
|
||||
|
||||
@@ -38,7 +38,7 @@ endfunction
|
||||
" Return the command to execute the linter in the projects directory.
|
||||
" If it doesn't, then this will fail when imports are needed.
|
||||
function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
let l:elm_package = ale#util#FindNearestFile(a:buffer, 'elm-package.json')
|
||||
let l:elm_package = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
|
||||
if empty(l:elm_package)
|
||||
let l:dir_set_cmd = ''
|
||||
else
|
||||
|
||||
@@ -12,7 +12,7 @@ function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'handlebars_embertemplatelint_executable')
|
||||
endif
|
||||
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/ember-template-lint',
|
||||
\ ale#Var(a:buffer, 'handlebars_embertemplatelint_executable')
|
||||
|
||||
@@ -11,7 +11,7 @@ function! ale_linters#html#htmlhint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'html_htmlhint_executable')
|
||||
endif
|
||||
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/htmlhint',
|
||||
\ ale#Var(a:buffer, 'html_htmlhint_executable')
|
||||
|
||||
@@ -16,7 +16,7 @@ function! ale_linters#javascript#eslint#GetExecutable(buffer) abort
|
||||
endif
|
||||
|
||||
" Look for the kinds of paths that create-react-app generates first.
|
||||
let l:executable = ale#util#ResolveLocalPath(
|
||||
let l:executable = ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/eslint/bin/eslint.js',
|
||||
\ ''
|
||||
@@ -26,7 +26,7 @@ function! ale_linters#javascript#eslint#GetExecutable(buffer) abort
|
||||
return l:executable
|
||||
endif
|
||||
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/eslint',
|
||||
\ ale#Var(a:buffer, 'javascript_eslint_executable')
|
||||
|
||||
@@ -12,7 +12,7 @@ function! ale_linters#javascript#flow#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'javascript_flow_executable')
|
||||
endif
|
||||
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/flow',
|
||||
\ ale#Var(a:buffer, 'javascript_flow_executable')
|
||||
@@ -20,7 +20,7 @@ function! ale_linters#javascript#flow#GetExecutable(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#GetCommand(buffer) abort
|
||||
let l:flow_config = ale#util#FindNearestFile(a:buffer, '.flowconfig')
|
||||
let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig')
|
||||
|
||||
if empty(l:flow_config)
|
||||
" Don't run Flow if we can't find a .flowconfig file.
|
||||
|
||||
@@ -12,7 +12,7 @@ function! ale_linters#javascript#jshint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'javascript_jshint_executable')
|
||||
endif
|
||||
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/jshint',
|
||||
\ ale#Var(a:buffer, 'javascript_jshint_executable')
|
||||
@@ -21,7 +21,7 @@ endfunction
|
||||
|
||||
function! ale_linters#javascript#jshint#GetCommand(buffer) abort
|
||||
" Search for a local JShint config locaation, and default to a global one.
|
||||
let l:jshint_config = ale#util#ResolveLocalPath(
|
||||
let l:jshint_config = ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ '.jshintrc',
|
||||
\ get(g:, 'ale_jshint_config_loc', '')
|
||||
|
||||
@@ -15,7 +15,7 @@ function! ale_linters#javascript#standard#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'javascript_standard_executable')
|
||||
endif
|
||||
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/standard',
|
||||
\ ale#Var(a:buffer, 'javascript_standard_executable')
|
||||
|
||||
@@ -15,7 +15,7 @@ function! ale_linters#javascript#xo#GetExecutable(buffer) abort
|
||||
return g:ale_javascript_xo_executable
|
||||
endif
|
||||
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/xo',
|
||||
\ g:ale_javascript_xo_executable
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
let g:ale_python_mypy_options = get(g:, 'ale_python_mypy_options', '')
|
||||
|
||||
function! ale_linters#python#mypy#GetCommand(buffer) abort
|
||||
let l:automatic_stubs_dir = ale#util#FindNearestDirectory(a:buffer, 'stubs')
|
||||
let l:automatic_stubs_dir = ale#path#FindNearestDirectory(a:buffer, 'stubs')
|
||||
" TODO: Add Windows support
|
||||
let l:automatic_stubs_command = (has('unix') && !empty(l:automatic_stubs_dir))
|
||||
\ ? 'MYPYPATH=' . l:automatic_stubs_dir . ' '
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
let g:ale_rust_cargo_use_check = get(g:, 'ale_rust_cargo_use_check', 0)
|
||||
|
||||
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
|
||||
if ale#util#FindNearestFile(a:bufnr, 'Cargo.toml') !=# ''
|
||||
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') !=# ''
|
||||
return 'cargo'
|
||||
else
|
||||
" if there is no Cargo.toml file, we don't use cargo even if it exists,
|
||||
|
||||
@@ -5,7 +5,7 @@ function! ale_linters#rust#rustc#RustcCommand(buffer_number) abort
|
||||
" Try to guess the library search path. If the project is managed by cargo,
|
||||
" it's usually <project root>/target/debug/deps/ or
|
||||
" <project root>/target/release/deps/
|
||||
let l:cargo_file = ale#util#FindNearestFile(a:buffer_number, 'Cargo.toml')
|
||||
let l:cargo_file = ale#path#FindNearestFile(a:buffer_number, 'Cargo.toml')
|
||||
|
||||
if l:cargo_file !=# ''
|
||||
let l:project_root = fnamemodify(l:cargo_file, ':h')
|
||||
|
||||
@@ -11,7 +11,7 @@ function! ale_linters#sass#stylelint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'sass_stylelint_executable')
|
||||
endif
|
||||
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ale#Var(a:buffer, 'sass_stylelint_executable')
|
||||
|
||||
@@ -11,7 +11,7 @@ function! ale_linters#scss#stylelint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'scss_stylelint_executable')
|
||||
endif
|
||||
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ale#Var(a:buffer, 'scss_stylelint_executable')
|
||||
|
||||
@@ -9,7 +9,7 @@ let g:ale_tex_chktex_options =
|
||||
|
||||
function! ale_linters#tex#chktex#GetCommand(buffer) abort
|
||||
" Check for optional .chktexrc
|
||||
let l:chktex_config = ale#util#FindNearestFile(
|
||||
let l:chktex_config = ale#path#FindNearestFile(
|
||||
\ a:buffer,
|
||||
\ '.chktexrc')
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ let g:ale_typescript_tslint_config_path =
|
||||
\ get(g:, 'ale_typescript_tslint_config_path', '')
|
||||
|
||||
function! ale_linters#typescript#tslint#GetExecutable(buffer) abort
|
||||
return ale#util#ResolveLocalPath(
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/tslint',
|
||||
\ ale#Var(a:buffer, 'typescript_tslint_executable')
|
||||
@@ -50,7 +50,7 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#typescript#tslint#BuildLintCommand(buffer) abort
|
||||
let l:tslint_config_path = ale#util#ResolveLocalPath(
|
||||
let l:tslint_config_path = ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'tslint.json',
|
||||
\ ale#Var(a:buffer, 'typescript_tslint_config_path')
|
||||
|
||||
Reference in New Issue
Block a user