From 5a47d878fbb837af4c89ab545f473f8526bd4d64 Mon Sep 17 00:00:00 2001 From: tatsuya Date: Sun, 13 Dec 2020 17:06:23 +0900 Subject: add spectral linter for yaml ci --- test/handler/test_spectral_handler.vader | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 test/handler/test_spectral_handler.vader (limited to 'test/handler') diff --git a/test/handler/test_spectral_handler.vader b/test/handler/test_spectral_handler.vader new file mode 100644 index 00000000..b315168f --- /dev/null +++ b/test/handler/test_spectral_handler.vader @@ -0,0 +1,52 @@ +Before: + runtime ale_linters/yaml/spectral.vim + +After: + call ale#linter#Reset() + +Execute(spectral handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'code': 'oas3-api-servers', + \ 'text': 'OpenAPI `servers` must be present and non-empty array.', + \ 'type': 'W' + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'code': 'oas3-schema', + \ 'text': 'Object should have required property `paths`.', + \ 'type': 'E' + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'code': 'openapi-tags', + \ 'text': 'OpenAPI object should have non-empty `tags` array.', + \ 'type': 'W' + \ }, + \ { + \ 'lnum': 3, + \ 'col': 6, + \ 'code': 'info-contact', + \ 'text': 'Info object should contain `contact` object.', + \ 'type': 'W' + \ }, + \ { + \ 'lnum': 3, + \ 'col': 6, + \ 'code': 'oas3-schema', + \ 'text': '`info` property should have required property `version`.', + \ 'type': 'E' + \ }, + \ ], + \ ale_linters#yaml#spectral#Handle(bufnr(''), [ + \ 'openapi.yml:1:1 warning oas3-api-servers "OpenAPI `servers` must be present and non-empty array."', + \ 'openapi.yml:1:1 error oas3-schema "Object should have required property `paths`."', + \ 'openapi.yml:1:1 warning openapi-tags "OpenAPI object should have non-empty `tags` array."', + \ 'openapi.yml:3:6 warning info-contact "Info object should contain `contact` object."', + \ 'openapi.yml:3:6 error oas3-schema "`info` property should have required property `version`."', + \ ]) -- cgit v1.2.3 From 997dd7f8fe45030e65b418c5f46e20d808b1c5eb Mon Sep 17 00:00:00 2001 From: tatsuya Date: Wed, 6 Jan 2021 13:22:08 +0900 Subject: add spectral handler --- test/handler/test_spectral_handler.vader | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/handler') diff --git a/test/handler/test_spectral_handler.vader b/test/handler/test_spectral_handler.vader index b315168f..89a3ff1b 100644 --- a/test/handler/test_spectral_handler.vader +++ b/test/handler/test_spectral_handler.vader @@ -43,7 +43,7 @@ Execute(spectral handler should parse lines correctly): \ 'type': 'E' \ }, \ ], - \ ale_linters#yaml#spectral#Handle(bufnr(''), [ + \ ale#handlers#spectral#HandleSpectralOutput(bufnr(''), [ \ 'openapi.yml:1:1 warning oas3-api-servers "OpenAPI `servers` must be present and non-empty array."', \ 'openapi.yml:1:1 error oas3-schema "Object should have required property `paths`."', \ 'openapi.yml:1:1 warning openapi-tags "OpenAPI object should have non-empty `tags` array."', -- cgit v1.2.3