refactor: use ale#Pad for option padding across the codebase (#5091)

Co-authored-by: PsickOSSH <PsickOSSH@protonmail.com>
This commit is contained in:
PsickOSSH
2026-02-07 09:23:48 +01:00
committed by GitHub
parent e762262f44
commit af5a38c697
45 changed files with 49 additions and 49 deletions

View File

@@ -38,7 +38,7 @@ function! ale#fixers#autoflake#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --in-place '
\ . ' %t',
\ 'read_temporary_file': 1,

View File

@@ -39,7 +39,7 @@ function! ale#fixers#autoimport#Fix(buffer) abort
return {
\ 'cwd': '%s:h',
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' -',
\}
endfunction

View File

@@ -38,7 +38,7 @@ function! ale#fixers#autopep8#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' -',
\}
endfunction

View File

@@ -6,6 +6,6 @@ function! ale#fixers#biome#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable) . ' check '
\ . '--write --stdin-file-path %s' . l:unsafe
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\}
endfunction

View File

@@ -28,7 +28,7 @@ function! ale#fixers#erblint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'eruby_erblint_options')
return ale#ruby#EscapeExecutable(l:executable, 'erblint')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --autocorrect --stdin %s'
endfunction

View File

@@ -10,7 +10,7 @@ function! ale#fixers#gnatpp#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -13,7 +13,7 @@ function! ale#fixers#mix_format#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'elixir_mix_format_options')
return l:executable . ' format'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t'
endfunction

View File

@@ -9,7 +9,7 @@ function! ale#fixers#npmgroovylint#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -99,7 +99,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort
return {
\ 'cwd': '%s:h',
\ 'command':ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --stdin-filepath %s --stdin',
\ 'process_with': 'ale#fixers#prettier#ProcessPrettierDOutput',
\}
@@ -110,7 +110,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort
return {
\ 'cwd': ale#fixers#prettier#GetCwd(a:buffer),
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --stdin-filepath %s --stdin',
\}
endif
@@ -118,7 +118,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' %t'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --write',
\ 'read_temporary_file': 1,
\}

View File

@@ -40,7 +40,7 @@ function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version) abort
\ 'cwd': '%s:h',
\ 'command': ale#Escape(l:executable)
\ . l:eslint_config_option
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --stdin-filepath %s --stdin',
\}
endif
@@ -49,7 +49,7 @@ function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version) abort
\ 'command': ale#Escape(l:executable)
\ . ' %t'
\ . l:eslint_config_option
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --write',
\ 'read_temporary_file': 1,
\}

View File

@@ -39,7 +39,7 @@ function! ale#fixers#pymarkdown#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . ' fix'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -18,7 +18,7 @@ function! ale#fixers#remark_lint#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : ''),
\ . ale#Pad(l:options),
\}
endfunction

View File

@@ -38,6 +38,6 @@ function! ale#fixers#reorder_python_imports#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '') . ' -',
\ . ale#Pad(l:options) . ' -',
\}
endfunction

View File

@@ -26,7 +26,7 @@ function! ale#fixers#rubocop#GetCommand(buffer, version) abort
let l:editor_mode = ale#semver#GTE(a:version, [1, 61, 0])
return ale#ruby#EscapeExecutable(l:executable, 'rubocop')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . (l:auto_correct_all ? ' --auto-correct-all' : ' --auto-correct')
\ . (l:editor_mode ? ' --editor-mode' : '')
\ . ' --force-exclusion --stdin %s'

View File

@@ -7,7 +7,7 @@ function! ale#fixers#sorbet#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'srb')
\ . ' tc'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --autocorrect --file %t'
endfunction

View File

@@ -10,7 +10,7 @@ function! ale#fixers#sqlformat#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' -'
\}
endfunction

View File

@@ -26,7 +26,7 @@ function! ale#fixers#standard#Fix(buffer) abort
return {
\ 'command': ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --fix --stdin < %s > %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -11,7 +11,7 @@ function! ale#fixers#standardrb#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'standardrb')
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --fix --force-exclusion --stdin %s'
endfunction

View File

@@ -7,7 +7,7 @@ function! ale#fixers#syntax_tree#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'stree')
\ . ' format'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t'
endfunction

View File

@@ -20,6 +20,6 @@ function! ale#fixers#yamlfix#Fix(buffer) abort
return {
\ 'cwd': '%s:h',
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '') . ' -',
\ . ale#Pad(l:options) . ' -',
\}
endfunction

View File

@@ -39,7 +39,7 @@ function! ale#handlers#djlint#GetCommand(buffer) abort
endif
return ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '') . ' %s'
\ . ale#Pad(l:options) . ' %s'
endfunction
function! ale#handlers#djlint#Handle(buffer, lines) abort

View File

@@ -54,7 +54,7 @@ function! ale#handlers#eslint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'javascript_eslint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' -f json --stdin --stdin-filename %s'
endfunction

View File

@@ -57,7 +57,7 @@ function! ale#handlers#shellcheck#GetCommand(buffer, version) abort
return '%e'
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
\ . l:external_option
\ . ' -f ' . l:format . ' -'

View File

@@ -17,7 +17,7 @@ function! ale#handlers#textlint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'textlint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' -f json --stdin --stdin-filename %s'
endfunction

View File

@@ -22,7 +22,7 @@ function! ale#handlers#writegood#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'writegood_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t'
endfunction

View File

@@ -81,7 +81,7 @@ function! ale#preview#ShowSelection(item_list, ...) abort
\ l:filename
\ . ':' . l:item.line
\ . ':' . l:item.column
\ . (!empty(l:match) ? ' ' . l:match : ''),
\ . ale#Pad(l:match),
\)
endfor