diff options
author | Jesse Harris <zigford@gmail.com> | 2019-03-30 01:25:55 +1000 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2019-03-29 15:25:55 +0000 |
commit | 000c37e77540310afc500a212401946c7bfd75fe (patch) | |
tree | b860d667c77b726f3f529bada981f487a9d0af45 /test/handler | |
parent | 442d672d8aa20d866c6c186d8a11ad63bb1a9c6d (diff) | |
download | ale-000c37e77540310afc500a212401946c7bfd75fe.zip |
PSScriptAnalyzer (#2370)
* Added psscriptanalyzer
* Added exclusions and documentation
* Added PSScriptAnalyzer handler test
Diffstat (limited to 'test/handler')
-rw-r--r-- | test/handler/test_psscriptanalyzer_handler.vader | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/handler/test_psscriptanalyzer_handler.vader b/test/handler/test_psscriptanalyzer_handler.vader new file mode 100644 index 00000000..060d5941 --- /dev/null +++ b/test/handler/test_psscriptanalyzer_handler.vader @@ -0,0 +1,42 @@ +Before: + runtime ale_linters/powershell/psscriptanalyzer.vim + +After: + call ale#linter#Reset() + +Execute(The psscriptanalyzer handler should handle basic information or warnings): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'type': 'I', + \ 'text': 'The cmdlet ''Get-GithubRepo'' does not have a help comment.', + \ 'code': 'PSProvideCommentHelp', + \ }, + \ { + \ 'lnum': 9, + \ 'type': 'W', + \ 'text': '''%'' is an alias of ''ForEach-Object''. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.', + \ 'code': 'PSAvoidUsingCmdletAliases', + \ }, + \ { + \ 'lnum': 23, + \ 'type': 'E', + \ 'text': 'The ComputerName parameter of a cmdlet should not be hardcoded as this will expose sensitive information about the system.', + \ 'code': 'PSAvoidUsingComputerNameHardcoded', + \ }, + \ ], + \ ale_linters#powershell#psscriptanalyzer#Handle(bufnr(''), [ + \ '1', + \ 'Information', + \ 'The cmdlet ''Get-GithubRepo'' does not have a help comment.', + \ 'PSProvideCommentHelp', + \ '9', + \ 'Warning', + \ '''%'' is an alias of ''ForEach-Object''. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.', + \ 'PSAvoidUsingCmdletAliases', + \ '23', + \ 'Error', + \ 'The ComputerName parameter of a cmdlet should not be hardcoded as this will expose sensitive information about the system.', + \ 'PSAvoidUsingComputerNameHardcoded', + \ ]) |