summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-09-05 19:06:07 +0100
committerw0rp <devw0rp@gmail.com>2020-09-05 19:06:07 +0100
commit152b2cb6910d9173d75a195c5a185b7f3f8aa696 (patch)
treebcb4e5fffe6f1234124c880a59bd31292b2d8bc0
parent844febb9fbfb66bb13dd652d958495e47f0bd408 (diff)
downloadale-152b2cb6910d9173d75a195c5a185b7f3f8aa696.zip
Clean up embertemplatelint code
Alias ember-template-lint to embertemplatelint so users can use either string to enable the linter.
-rw-r--r--ale_linters/handlebars/embertemplatelint.vim13
-rw-r--r--doc/ale-handlebars.txt6
-rw-r--r--test/command_callback/test_embertemplatelint_command_callbacks.vader17
-rw-r--r--test/test_embertemplatelint_executable_detection.vader22
4 files changed, 28 insertions, 30 deletions
diff --git a/ale_linters/handlebars/embertemplatelint.vim b/ale_linters/handlebars/embertemplatelint.vim
index 31d65b70..bd4d1d31 100644
--- a/ale_linters/handlebars/embertemplatelint.vim
+++ b/ale_linters/handlebars/embertemplatelint.vim
@@ -19,11 +19,11 @@ endfunction
function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort
return ale#semver#RunWithVersionCheck(
- \ a:buffer,
- \ ale_linters#handlebars#embertemplatelint#GetExecutable(a:buffer),
- \ '%e --version',
- \ function('ale_linters#handlebars#embertemplatelint#GetCommand'),
- \ )
+ \ a:buffer,
+ \ ale_linters#handlebars#embertemplatelint#GetExecutable(a:buffer),
+ \ '%e --version',
+ \ function('ale_linters#handlebars#embertemplatelint#GetCommand'),
+ \)
endfunction
function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
@@ -52,7 +52,8 @@ function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
endfunction
call ale#linter#Define('handlebars', {
-\ 'name': 'ember-template-lint',
+\ 'name': 'embertemplatelint',
+\ 'aliases': ['ember-template-lint'],
\ 'executable': function('ale_linters#handlebars#embertemplatelint#GetExecutable'),
\ 'command': function('ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck'),
\ 'callback': 'ale_linters#handlebars#embertemplatelint#Handle',
diff --git a/doc/ale-handlebars.txt b/doc/ale-handlebars.txt
index 5daec5b3..4a5a3870 100644
--- a/doc/ale-handlebars.txt
+++ b/doc/ale-handlebars.txt
@@ -14,7 +14,8 @@ ember-template-lint *ale-handlebars-embertemplatelint*
g:ale_handlebars_embertemplatelint_executable
*g:ale_handlebars_embertemplatelint_executable*
- Type: |String| *b:ale_handlebars_embertemplatelint_executable*
+ *b:ale_handlebars_embertemplatelint_executable*
+ Type: |String|
Default: `'ember-template-lint'`
See |ale-integrations-local-executables|
@@ -22,7 +23,8 @@ g:ale_handlebars_embertemplatelint_executable
g:ale_handlebars_embertemplatelint_use_global
*g:ale_handlebars_embertemplatelint_use_global*
- Type: |Number| *b:ale_handlebars_embertemplatelint_use_global*
+ *b:ale_handlebars_embertemplatelint_use_global*
+ Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
diff --git a/test/command_callback/test_embertemplatelint_command_callbacks.vader b/test/command_callback/test_embertemplatelint_command_callbacks.vader
new file mode 100644
index 00000000..97687d29
--- /dev/null
+++ b/test/command_callback/test_embertemplatelint_command_callbacks.vader
@@ -0,0 +1,17 @@
+Before:
+ call ale#assert#SetUpLinterTest('handlebars', 'embertemplatelint')
+
+ GivenCommandOutput ['1.6.0']
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(ember-template-lint executables runs the right command):
+ AssertLinter 'ember-template-lint',
+ \ ale#Escape('ember-template-lint') . ' --json --filename %s'
+
+Execute(old ember-template-lint executables runs the right command):
+ GivenCommandOutput []
+
+ AssertLinter 'ember-template-lint',
+ \ ale#Escape('ember-template-lint') . ' --json %t'
diff --git a/test/test_embertemplatelint_executable_detection.vader b/test/test_embertemplatelint_executable_detection.vader
deleted file mode 100644
index bd0f5dd9..00000000
--- a/test/test_embertemplatelint_executable_detection.vader
+++ /dev/null
@@ -1,22 +0,0 @@
-Before:
- call ale#test#SetDirectory('/testplugin/test')
-
- runtime ale_linters/handlebars/embertemplatelint.vim
-
-After:
- call ale#test#RestoreDirectory()
- call ale#linter#Reset()
-
-Execute(ember-template-lint executables runs the right command):
- call ale#test#SetFilename('ember-template-lint-test-files/app/template.hbs')
-
- AssertEqual
- \ ale_linters#handlebars#embertemplatelint#GetCommand(bufnr(''), [2, 0, 0]),
- \ '%e --json --filename %s'
-
-Execute(old ember-template-lint executables runs the right command):
- call ale#test#SetFilename('ember-template-lint-test-files/app/template.hbs')
-
- AssertEqual
- \ ale_linters#handlebars#embertemplatelint#GetCommand(bufnr(''), [1, 5, 0]),
- \ '%e --json %t'