-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PSScriptAnalyzer #2370
PSScriptAnalyzer #2370
Conversation
Ps, I’m not sure why this is failing at the moment. Could someone with more knowledge of the tests give me a hint? |
|
||
" let g:ale_powershell_psscriptanalyzer_exclusions = | ||
" \ 'PSAvoidUsingWriteHost,PSAvoidGlobalVars' | ||
call ale#Set('powershell_psscriptanalyzer_exclusions', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should just write ''
as the second argument here.
call ale#Set('powershell_psscriptanalyzer_module', | ||
\ 'psscriptanalyzer') | ||
|
||
" GetExecutable {{{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of these {{{
and }}}
comments. You can use the indentation levels for folding instead.
\ . l:module . ';$m.Version.ToString()}"') | ||
|
||
return l:executable . l:module_string | ||
endfunction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you aren't using the code, you should remove it.
let l:tempscript = | ||
\ ale#util#Tempname() . (has('win32') ? '\' : '/') . l:filename | ||
|
||
if ale#command#CreateTempFile(a:buffer, l:tempscript, a:input) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ale#command#CreateFile
or ale#Command#ManageFile
instead. CreateTempFile
isn't intended for use outside of some very specific parts of code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback, implemented your suggestions in commit a839a9e
I'll merge this and fix the linter errors. |
@zigford Do you know how / where I specify the I've looked through the source here (though I don't read VimScript very well) and a few PowerShell docs on Microsoft Learn, but I can't figure out how to do it. This is what I have in the root of my project directory (where I'm running vim from), but the warnings are not being ignored as I expected:
@{
IncludeRules = @()
ExcludeRules = @(
'PSAvoidUsingCmdletAliases',
'PSUseDeclaredVarsMoreThanAssignments'
)
} When I run |
I think it’s in the :help but put something like this in your vimrc |
I am using I suppose that wasn't available at the time or otherwise didn't get implemented? |
I use powershell in Vim a lot and have not written any significant vimscript before, and I saw there was an open issue #1264 for a new linter.