diff options
author | Carl Smedstad <carl.smedstad@protonmail.com> | 2023-04-13 01:51:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-13 08:51:52 +0900 |
commit | 93100159a2ee71fea8853dcd45ec48c8222516fe (patch) | |
tree | 65b4e8a3be81476b7dd38dbe1e430d51f9b1bdc8 /test/handler | |
parent | 57254db9ef1e0b0bf21466ed2d3ebaf60338768f (diff) | |
download | ale-93100159a2ee71fea8853dcd45ec48c8222516fe.zip |
Add support for Bicep when installed as a plugin to Azure CLI (#4496)
* Add support for Bicep when installed as a plugin to Azure CLI
The compiler for Microsoft's DSL Bicep can be installed both
independently and as a plugin to Azure CLI. The latter is probably how
most people install it.
The program output is the same but Azure CLI wraps the arguments and has
a slightly different interface, hence I opted to copy the old linter and
modify it to match the plugin arguments.
* Fix bicep/az_bicep tests, arguments and parsing
* Actually test the ale_linters#bicep#az_bicep#Handle function in the
test that should test that function, not
ale_linters#bicep#bicep#Handle.
* Use the same method as in bicep/bicep for discarding output file, i.e.
by specifying --outfile to a null file.
* Fix parsing of occasionally occurring leading error type (such as
'ERROR: ').
* Correct option defaults for bicep & az_bicep specified in documentation
Diffstat (limited to 'test/handler')
-rw-r--r-- | test/handler/test_bicep_az_bicep_handler.vader | 41 | ||||
-rw-r--r-- | test/handler/test_bicep_bicep_handler.vader | 4 |
2 files changed, 44 insertions, 1 deletions
diff --git a/test/handler/test_bicep_az_bicep_handler.vader b/test/handler/test_bicep_az_bicep_handler.vader new file mode 100644 index 00000000..5205b83b --- /dev/null +++ b/test/handler/test_bicep_az_bicep_handler.vader @@ -0,0 +1,41 @@ +Before: + runtime ale_linters/bicep/az_bicep.vim + +After: + Restore + + call ale#linter#Reset() + +Execute(The az_bicep handler should handle basic warnings): + AssertEqual + \ [ + \ { + \ 'filename': '/tmp/nvimhxqs5D/1/dns.bicep', + \ 'lnum': 7, + \ 'col': 10, + \ 'type': 'W', + \ 'code': 'no-unused-existing-resources', + \ 'text': 'Existing resource "asdasd" is declared but never used. [https://aka.ms/bicep/linter/no-unused-existing-resources]', + \ }, + \ { + \ 'filename': '/tmp/nvimhxqs5D/1/dns.bicep', + \ 'lnum': 106, + \ 'col': 6, + \ 'type': 'E', + \ 'code': 'BCP019', + \ 'text': 'Expected a new line character at this location.', + \ }, + \ { + \ 'filename': '/tmp/cluster.bicep', + \ 'lnum': 25, + \ 'col': 30, + \ 'type': 'E', + \ 'code': 'BCP334', + \ 'text': 'The provided value has no configured minimum length and may be too short to assign to a target with a configured minimum length of 1.', + \ }, + \ ], + \ ale_linters#bicep#az_bicep#Handle(1, [ + \ '/tmp/nvimhxqs5D/1/dns.bicep(7,10) : Warning no-unused-existing-resources: Existing resource "asdasd" is declared but never used. [https://aka.ms/bicep/linter/no-unused-existing-resources]', + \ '/tmp/nvimhxqs5D/1/dns.bicep(106,6) : Error BCP019: Expected a new line character at this location.', + \ 'ERROR: /tmp/cluster.bicep(25,30) : Warning BCP334: The provided value has no configured minimum length and may be too short to assign to a target with a configured minimum length of 1.', + \ ]) diff --git a/test/handler/test_bicep_bicep_handler.vader b/test/handler/test_bicep_bicep_handler.vader index d105cae5..b91c2551 100644 --- a/test/handler/test_bicep_bicep_handler.vader +++ b/test/handler/test_bicep_bicep_handler.vader @@ -6,10 +6,11 @@ After: call ale#linter#Reset() -Execute(The cmake_lint handler should handle basic warnings): +Execute(The bicep handler should handle basic warnings): AssertEqual \ [ \ { + \ 'filename': '/tmp/nvimhxqs5D/1/dns.bicep', \ 'lnum': 7, \ 'col': 10, \ 'type': 'W', @@ -17,6 +18,7 @@ Execute(The cmake_lint handler should handle basic warnings): \ 'text': 'Existing resource "asdasd" is declared but never used. [https://aka.ms/bicep/linter/no-unused-existing-resources]', \ }, \ { + \ 'filename': '/tmp/nvimhxqs5D/1/dns.bicep', \ 'lnum': 106, \ 'col': 6, \ 'type': 'E', |