From db85b931ec83de3382b75b7e9a18f1cf8ae8ce43 Mon Sep 17 00:00:00 2001 From: w0rp Date: Wed, 4 Jul 2018 08:36:34 +0100 Subject: [PATCH] Remove deprecated code for the 2.0 release --- ale_linters/html/tidy.vim | 13 +-------- ale_linters/python/flake8.vim | 13 +-------- autoload/ale/engine.vim | 3 -- autoload/ale/statusline.vim | 52 ----------------------------------- plugin/ale.vim | 28 ------------------- test/test_statusline.vader | 41 --------------------------- 6 files changed, 2 insertions(+), 148 deletions(-) diff --git a/ale_linters/html/tidy.vim b/ale_linters/html/tidy.vim index 3af64d7432..913cdade90 100644 --- a/ale_linters/html/tidy.vim +++ b/ale_linters/html/tidy.vim @@ -1,21 +1,10 @@ " Author: KabbAmine " 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({ diff --git a/ale_linters/python/flake8.vim b/ale_linters/python/flake8.vim index fdc4ac9487..358f51a490 100644 --- a/ale_linters/python/flake8.vim +++ b/ale_linters/python/flake8.vim @@ -1,13 +1,8 @@ " Author: w0rp " 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) \ : '' diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim index 714c75b15e..d97b6937ea 100644 --- a/autoload/ale/engine.vim +++ b/autoload/ale/engine.vim @@ -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 User ALELintPost - " remove in 2.0 - " Old DEPRECATED name; call it for backwards compatibility. - silent doautocmd User ALELint endif endfunction diff --git a/autoload/ale/statusline.vim b/autoload/ale/statusline.vim index 851618ccd8..94fbd6c9d9 100644 --- a/autoload/ale/statusline.vim +++ b/autoload/ale/statusline.vim @@ -1,14 +1,6 @@ " Author: KabbAmine " 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 diff --git a/plugin/ale.vim b/plugin/ale.vim index 2ea30a30dd..3bd12015a7 100644 --- a/plugin/ale.vim +++ b/plugin/ale.vim @@ -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(''))) | endif autocmd QuitPre * call ale#events#QuitEvent(str2nr(expand(''))) 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 diff --git a/test/test_statusline.vader b/test/test_statusline.vader index 0ce1d36faa..d928e7ee2e 100644 --- a/test/test_statusline.vader +++ b/test/test_statusline.vader @@ -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()