mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-27 22:41:10 +08:00
PSScriptAnalyzer (#2370)
* Added psscriptanalyzer * Added exclusions and documentation * Added PSScriptAnalyzer handler test
This commit is contained in:
42
test/handler/test_psscriptanalyzer_handler.vader
Normal file
42
test/handler/test_psscriptanalyzer_handler.vader
Normal file
@@ -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',
|
||||
\ ])
|
||||
Reference in New Issue
Block a user