Open bergmeister opened 4 years ago
I kinda removed it on purpose. Or rather, I didn't add it back in when doing the Omnisharp work.
My reasoning was:
I really want this kind of integration but I want to do it better. Also, since PSScriptAnalyzer's 2.0 release is in planning and the settings structure could change as a result, I didn't want to jump into this feature before that.
I'd be ok bringing back the experience we already had, but it's not going to be a priority for us right at the moment.
Yes, the feature is very incomplete and it's probably going to take a long time until it will be implemented. It also has confused user's at time due to the setting not persisting after vs-code closes. I myself use it only to show the default set of PSSA rules at talks and how to enable all rules.
In this case I'd rather remove the entry in package.json
because having a command that does not do anything is even more confusing IMHO
Looking forward to having 'Select PSScriptAnalyzer Rules' removed from the command palette since it doesn't do anything. Thanks bergmeister for putting a in a pull request!
As a brand new user to VS Code and using it for PowerShell (and took me hours of searching to find this item after I discovered it didn't work), what ARE the default rules then? Or where can I find the default config file for them?
I found the information about creating my own PSScriptAnalyzerSettings.psd1 file and I did get that to work, but having a heck of a time getting the rule set I want.
Mainly I want to disable the PSUseDeclaredVarsMoreThanAssignments rule from the default set. so I have this in my .psd1 file: ExcludeRules = @('PSUseDeclaredVarsMoreThanAssignments')
That seems to work as far as disabling that rule, but then I apparently now have a ton of rules enabled that must not be part of the default set. (I see bunches of new warnings that I didn't see before putting this custom settings file in place.)
I also see this in the example .psd1 file: IncludeRules = @('PSAvoidDefaultValueSwitchParameter', 'PSMisleadingBacktick', 'PSMissingModuleManifestField', 'PSReservedCmdletChar', 'PSReservedParams', 'PSShouldProcess', 'PSUseApprovedVerbs', 'PSAvoidUsingCmdletAliases', 'PSUseDeclaredVarsMoreThanAssignments')
but I commented it out because I thought it was only an example and I didn't explicitly want to limit to that rule set if the default is more than that. Or IS that the default rule set?
@zaphod4254 The default rules enabled in the extension are defined here, which as you noticed are only a small subset of all rules and your approach using a settings file is correct. https://github.com/PowerShell/PowerShellEditorServices/blob/512df9ea3968aaf3aa0639d84f1f9b7ef781a454/src/PowerShellEditorServices/Services/Analysis/AnalysisService.cs#L65-L81
Thank you. The flip question is, how do I know what all of the available rules are, in case I might want to add any of them?
You can run Get-ScriptAnalyzerRule
in the integrated terminal to see all rules. Extensive details about each rules is in the rule documentation here: https://github.com/PowerShell/PSScriptAnalyzer/tree/master/RuleDocumentation
Using 2020.1.0 but I have seen it before the recent update. Going back to previous release, I found that 2019.9.0 was the last version where it still worked therefore it something in between 2019.9.0 and 2019.11.0 ,which is likely going to be the omnisharp refactoring @TylerLeonhardt
System Details Output
Issue Description
Open a PowerShell file to start the extension. When selecting the 'Select PSScriptAnalyzer rules' nothing happens
Expected Behaviour
A dropdown menu of PSSA rules should come up.
Actual Behaviour
Nothing happens