-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement support for apkbuild-fixer (#4881)
I am not the author of a single file, but have full permissions from the original author for permission for submitting this to ALE under the 2-Clause BSD licence. See: https://gitlab.alpinelinux.org/Leo/apkbuild.vim/-/issues/3
- Loading branch information
1 parent
e82fd24
commit d69f8fe
Showing
7 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
" Author: Leo <[email protected]> | ||
" Description: Fix policy violations found by apkbuild-lint | ||
|
||
call ale#Set('apkbuild_apkbuild_fixer_executable', 'apkbuild-fixer') | ||
call ale#Set('apkbuild_apkbuild_fixer_lint_executable', get(g:, 'ale_apkbuild_apkbuild_lint_executable')) | ||
call ale#Set('apkbuild_apkbuild_fixer_options', '') | ||
|
||
function! ale#fixers#apkbuild_fixer#Fix(buffer) abort | ||
let l:executable = ale#Var(a:buffer, 'apkbuild_apkbuild_fixer_executable') | ||
let l:options = ale#Var(a:buffer, 'apkbuild_apkbuild_fixer_options') | ||
|
||
return { | ||
\ 'command': ale#Escape(l:executable) | ||
\ . ' -p ' . ale#Var(a:buffer, 'apkbuild_apkbuild_fixer_lint_executable') | ||
\ . (empty(l:options) ? '' : ' ' . l:options) | ||
\ . ' %t', | ||
\ 'read_temporary_file': 1, | ||
\} | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Before: | ||
call ale#assert#SetUpFixerTest('apkbuild', 'apkbuild-fixer') | ||
|
||
After: | ||
call ale#assert#TearDownFixerTest() | ||
|
||
Execute(The apkbuild-fixer callback should return the correct default values): | ||
AssertFixer { | ||
\ 'read_temporary_file': 1, | ||
\ 'command': ale#Escape('apkbuild-fixer') . ' -p apkbuild-lint %t', | ||
\} | ||
|
||
Execute(The apkbuild-fixer callback should include custom apkbuild-fixer options): | ||
let g:ale_apkbuild_apkbuild_fixer_executable = "another-apkbuild-fixer" | ||
let g:ale_apkbuild_apkbuild_fixer_options = "-s" | ||
|
||
AssertFixer { | ||
\ 'read_temporary_file': 1, | ||
\ 'command': ale#Escape('another-apkbuild-fixer') . ' -p apkbuild-lint -s %t' | ||
\} |