mirror of https://github.com/dense-analysis/ale
Remove deprecated code for the 2.0 release
This commit is contained in:
parent
602e7fa00f
commit
db85b931ec
|
@ -1,21 +1,10 @@
|
|||
" Author: KabbAmine <amine.kabb@gmail.com>
|
||||
" Description: This file adds support for checking HTML code with tidy.
|
||||
|
||||
" CLI options
|
||||
let g:ale_html_tidy_executable = get(g:, 'ale_html_tidy_executable', 'tidy')
|
||||
" remove in 2.0
|
||||
" Look for the old _args variable first.
|
||||
let s:deprecation_warning_echoed = 0
|
||||
let s:default_options = get(g:, 'ale_html_tidy_args', '-q -e -language en')
|
||||
let g:ale_html_tidy_options = get(g:, 'ale_html_tidy_options', s:default_options)
|
||||
let g:ale_html_tidy_options = get(g:, 'ale_html_tidy_options', '-q -e -language en')
|
||||
|
||||
function! ale_linters#html#tidy#GetCommand(buffer) abort
|
||||
" remove in 2.0
|
||||
if exists('g:ale_html_tidy_args') && !s:deprecation_warning_echoed
|
||||
execute 'echom ''Rename your g:ale_html_tidy_args setting to g:ale_html_tidy_options instead. Support for this will removed in ALE 2.0.'''
|
||||
let s:deprecation_warning_echoed = 1
|
||||
endif
|
||||
|
||||
" Specify file encoding in options
|
||||
" (Idea taken from https://github.com/scrooloose/syntastic/blob/master/syntax_checkers/html/tidy.vim)
|
||||
let l:file_encoding = get({
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: flake8 for python files
|
||||
|
||||
" remove in 2.0
|
||||
" Support an old setting as a fallback.
|
||||
let s:deprecation_warning_echoed = 0
|
||||
let s:default_options = get(g:, 'ale_python_flake8_args', '')
|
||||
|
||||
call ale#Set('python_flake8_executable', 'flake8')
|
||||
call ale#Set('python_flake8_options', s:default_options)
|
||||
call ale#Set('python_flake8_options', '')
|
||||
call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_flake8_change_directory', 1)
|
||||
|
||||
|
@ -40,12 +35,6 @@ function! ale_linters#python#flake8#VersionCheck(buffer) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort
|
||||
" remove in 2.0
|
||||
if exists('g:ale_python_flake8_args') && !s:deprecation_warning_echoed
|
||||
execute 'echom ''Rename your g:ale_python_flake8_args setting to g:ale_python_flake8_options instead. Support for this will removed in ALE 2.0.'''
|
||||
let s:deprecation_warning_echoed = 1
|
||||
endif
|
||||
|
||||
let l:cd_string = ale#Var(a:buffer, 'python_flake8_change_directory')
|
||||
\ ? ale#path#BufferCdString(a:buffer)
|
||||
\ : ''
|
||||
|
|
|
@ -270,9 +270,6 @@ function! ale#engine#SetResults(buffer, loclist) abort
|
|||
|
||||
" Call user autocommands. This allows users to hook into ALE's lint cycle.
|
||||
silent doautocmd <nomodeline> User ALELintPost
|
||||
" remove in 2.0
|
||||
" Old DEPRECATED name; call it for backwards compatibility.
|
||||
silent doautocmd <nomodeline> User ALELint
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
" Author: KabbAmine <amine.kabb@gmail.com>
|
||||
" Description: Statusline related function(s)
|
||||
|
||||
" remove in 2.0
|
||||
"
|
||||
" A deprecated setting for ale#statusline#Status()
|
||||
" See :help ale#statusline#Count() for getting status reports.
|
||||
let g:ale_statusline_format = get(g:, 'ale_statusline_format',
|
||||
\ ['%d error(s)', '%d warning(s)', 'OK']
|
||||
\)
|
||||
|
||||
function! s:CreateCountDict() abort
|
||||
" Keys 0 and 1 are for backwards compatibility.
|
||||
" The count object used to be a List of [error_count, warning_count].
|
||||
|
@ -76,47 +68,3 @@ function! ale#statusline#Count(buffer) abort
|
|||
" The Dictionary is copied here before exposing it to other plugins.
|
||||
return copy(s:GetCounts(a:buffer))
|
||||
endfunction
|
||||
|
||||
" This is the historical format setting which could be configured before.
|
||||
function! s:StatusForListFormat() abort
|
||||
let [l:error_format, l:warning_format, l:no_errors] = g:ale_statusline_format
|
||||
let l:counts = s:GetCounts(bufnr(''))
|
||||
|
||||
" Build strings based on user formatting preferences.
|
||||
let l:errors = l:counts[0] ? printf(l:error_format, l:counts[0]) : ''
|
||||
let l:warnings = l:counts[1] ? printf(l:warning_format, l:counts[1]) : ''
|
||||
|
||||
" Different formats based on the combination of errors and warnings.
|
||||
if empty(l:errors) && empty(l:warnings)
|
||||
let l:res = l:no_errors
|
||||
elseif !empty(l:errors) && !empty(l:warnings)
|
||||
let l:res = printf('%s %s', l:errors, l:warnings)
|
||||
else
|
||||
let l:res = empty(l:errors) ? l:warnings : l:errors
|
||||
endif
|
||||
|
||||
return l:res
|
||||
endfunction
|
||||
|
||||
" remove in 2.0
|
||||
"
|
||||
" Returns a formatted string that can be integrated in the statusline.
|
||||
"
|
||||
" This function is deprecated, and should not be used. Use the airline plugin
|
||||
" instead, or write your own status function with ale#statusline#Count()
|
||||
function! ale#statusline#Status() abort
|
||||
if !get(g:, 'ale_deprecation_ale_statusline_status', 0)
|
||||
execute 'echom ''ale#statusline#Status() is deprecated, use ale#statusline#Count() to write your own function.'''
|
||||
let g:ale_deprecation_ale_statusline_status = 1
|
||||
endif
|
||||
|
||||
if !exists('g:ale_statusline_format')
|
||||
return 'OK'
|
||||
endif
|
||||
|
||||
if type(g:ale_statusline_format) == type([])
|
||||
return s:StatusForListFormat()
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
|
|
@ -32,12 +32,6 @@ if !s:has_features
|
|||
finish
|
||||
endif
|
||||
|
||||
" remove in 2.0
|
||||
if has('nvim') && !has('nvim-0.2.0') && !get(g:, 'ale_use_deprecated_neovim')
|
||||
execute 'echom ''ALE support for NeoVim versions below 0.2.0 is deprecated.'''
|
||||
execute 'echom ''Use `let g:ale_use_deprecated_neovim = 1` to silence this warning for now.'''
|
||||
endif
|
||||
|
||||
" Set this flag so that other plugins can use it, like airline.
|
||||
let g:loaded_ale = 1
|
||||
|
||||
|
@ -231,25 +225,3 @@ augroup ALECleanupGroup
|
|||
autocmd BufDelete * if exists('*ale#engine#Cleanup') | call ale#engine#Cleanup(str2nr(expand('<abuf>'))) | endif
|
||||
autocmd QuitPre * call ale#events#QuitEvent(str2nr(expand('<abuf>')))
|
||||
augroup END
|
||||
|
||||
" Backwards Compatibility
|
||||
|
||||
" remove in 2.0
|
||||
function! ALELint(delay) abort
|
||||
if !get(g:, 'ale_deprecation_ale_lint', 0)
|
||||
execute 'echom ''ALELint() is deprecated, use ale#Queue() instead.'''
|
||||
let g:ale_deprecation_ale_lint = 1
|
||||
endif
|
||||
|
||||
call ale#Queue(a:delay)
|
||||
endfunction
|
||||
|
||||
" remove in 2.0
|
||||
function! ALEGetStatusLine() abort
|
||||
if !get(g:, 'ale_deprecation_ale_get_status_line', 0)
|
||||
execute 'echom ''ALEGetStatusLine() is deprecated.'''
|
||||
let g:ale_deprecation_ale_get_status_line = 1
|
||||
endif
|
||||
|
||||
return ale#statusline#Status()
|
||||
endfunction
|
||||
|
|
|
@ -91,43 +91,6 @@ Execute (Count should be match the loclist):
|
|||
Execute (Output should be empty for non-existent buffer):
|
||||
AssertEqual Counts({}), ale#statusline#Count(9001)
|
||||
|
||||
Execute (Status() should return just errors for the old format):
|
||||
let g:ale_statusline_format = ['%sE', '%sW', 'OKIE']
|
||||
let g:ale_buffer_info = {bufnr(''): {}}
|
||||
call ale#statusline#Update(bufnr(''), [
|
||||
\ {'bufnr': bufnr(''), 'type': 'E'},
|
||||
\ {'bufnr': bufnr(''), 'type': 'E', 'sub_type': 'style'},
|
||||
\])
|
||||
AssertEqual '2E', ale#statusline#Status()
|
||||
|
||||
Execute (Status() should return just warnings for the old format):
|
||||
let g:ale_statusline_format = ['%sE', '%sW', 'OKIE']
|
||||
let g:ale_buffer_info = {bufnr(''): {}}
|
||||
call ale#statusline#Update(bufnr(''), [
|
||||
\ {'bufnr': bufnr(''), 'type': 'W'},
|
||||
\ {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'},
|
||||
\ {'bufnr': bufnr(''), 'type': 'I'},
|
||||
\])
|
||||
AssertEqual '3W', ale#statusline#Status()
|
||||
|
||||
Execute (Status() should return errors and warnings for the old format):
|
||||
let g:ale_statusline_format = ['%sE', '%sW', 'OKIE']
|
||||
let g:ale_buffer_info = {bufnr(''): {}}
|
||||
call ale#statusline#Update(bufnr(''), [
|
||||
\ {'bufnr': bufnr(''), 'type': 'E'},
|
||||
\ {'bufnr': bufnr(''), 'type': 'E', 'sub_type': 'style'},
|
||||
\ {'bufnr': bufnr(''), 'type': 'W'},
|
||||
\ {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'},
|
||||
\ {'bufnr': bufnr(''), 'type': 'I'},
|
||||
\])
|
||||
AssertEqual '2E 3W', ale#statusline#Status()
|
||||
|
||||
Execute (Status() should return the custom 'OK' string with the old format):
|
||||
let g:ale_statusline_format = ['%sE', '%sW', 'OKIE']
|
||||
let g:ale_buffer_info = {bufnr(''): {}}
|
||||
call ale#statusline#Update(bufnr(''), [])
|
||||
AssertEqual 'OKIE', ale#statusline#Status()
|
||||
|
||||
Execute(ale#statusline#Update shouldn't blow up when globals are undefined):
|
||||
unlet! g:ale_statusline_format
|
||||
call ale#statusline#Update(1, [])
|
||||
|
@ -135,7 +98,3 @@ Execute(ale#statusline#Update shouldn't blow up when globals are undefined):
|
|||
Execute(ale#statusline#Count should return 0 counts when globals are undefined):
|
||||
unlet! g:ale_statusline_format
|
||||
AssertEqual Counts({}), ale#statusline#Count(1)
|
||||
|
||||
Execute(ale#statusline#Status should return 'OK' when globals are undefined):
|
||||
unlet! g:ale_statusline_format
|
||||
AssertEqual 'OK', ale#statusline#Status()
|
||||
|
|
Loading…
Reference in New Issue