You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had this error when doing: <ctrl>+<shift>+P, PSScript...
After Uninstall and reinstall the Powershell extension ( version 1.3.2, the same as it was before), there's another issue:
System Details
Operating system name and version: Windows 10.0.14393
Actually, the thought that something is wrong, started with noticing that the warning and error count ( in the left lower corner) were and are always 0.
OK
"powershell.scriptAnalysis.settingsPath": "bin//PSScriptAnalyzerRules.psd1",
was set to a non-existing file, so this was my own fault.
Maybe if the error message could say "file not found" I would realize that sooner than with "cannot update the rules"
Hey Klass, sorry for the delay in response. I'm glad you figured out the issue! You're right, we should indicate that the settings file is missing, I'll reopen this issue so we can track a fix for that.
Thanks for identifying the bug, as I am not so familiar with the Setup and untill the fix is included, could perhaps be clarified
i) which file name should be entered into this Setting and
ii) If the full path or a relative path should be included (and if relative, relative from where)
That would be a great help to start using this part of teh extension
i) which file name should be entered into this Setting and
You can use any filename you want but the tyipcal filename is PSScriptAnalyzerSettings.psd1.
ii) If the full path or a relative path should be included (and if relative, relative from where)
When using a relative path in a workspace settings file, the path is relative to the workspace root. If you put the setting in your user profile, it should be an absolute path.
Rob Holt (@rjmholt) I don't think this feature was designed to persist the set of selected rules between sessions. Another reason I prefer to use a PSSA settings file for the workspace.
I think it is a minimum viable feature (for the moment) to tell people having to just edit the PSSA setting file themselves but of course, it could be improved. But what is a no go and problem is the fact that when no PSSA settings path is specified, the rules selected via Ctrl+Shift+P are not persisted!
I suggest that when selecting a rule AND the PSScriptAnalyzerSettingPath setting of VSCode is not set, then the extension should create such a file in the .vscode folder and make the Vscode setting point to it. Without this capability, the Vscode feature of selecting rules via Ctrl+Shift+P is useless and misleading. I myself saw this feature once and thought it would be nice to people who like to use GUIs, so I showed it at psconf.eu but not knowing that it does not persist because I personally use settings files...
I would also like to complain about the fact that not all rules are turned on by default, especially AvoidPossibleIncorrectComparisonWithNull.
There are both older and newer issues that are closely related:
#823 (David Wilson (@daviwil)) suggests adding support for persisting the existing GUI-based rules selection (>PowerShell: Select PSScriptAnalyzer Rules)
#1443 (Rob Holt (@rjmholt)) doesn't reference the GUI method, but proposes supporting persistent rule selection via settings.json specifically
Also, there is another closely related issue that I decided to break out into a separate one:
If you use a relative path in setting powershell.scriptAnalysis.settingsPath, for per-workspace settings, opening a workspace that doesn't have such a file quietly deactivates all rules - see #2287
Also related: #2190, where TylerLeonhardt suggests automatically picking up a PSScriptAnalyzerSettings.psd1 file in the workspace root.
Activity
PowerDBAKlaas commentedon Jun 21, 2017
Actually, the thought that something is wrong, started with noticing that the warning and error count ( in the left lower corner) were and are always 0.
PowerDBAKlaas commentedon Jun 21, 2017
OK
"powershell.scriptAnalysis.settingsPath": "bin//PSScriptAnalyzerRules.psd1",
was set to a non-existing file, so this was my own fault.
Maybe if the error message could say "file not found" I would realize that sooner than with "cannot update the rules"
daviwil commentedon Jun 21, 2017
Hey Klass, sorry for the delay in response. I'm glad you figured out the issue! You're right, we should indicate that the settings file is missing, I'll reopen this issue so we can track a fix for that.
PorkyProgs commentedon Jan 17, 2018
Thanks for identifying the bug, as I am not so familiar with the Setup and untill the fix is included, could perhaps be clarified
i) which file name should be entered into this Setting and
ii) If the full path or a relative path should be included (and if relative, relative from where)
That would be a great help to start using this part of teh extension
rjmholt commentedon Apr 24, 2018
@tylerl0706, it looks like there's a bug in the extension where we're not persisting PSSA rule file settings, as above.
rkeithhill commentedon Apr 24, 2018
PorkyProgs (@PorkyProgs)
You can use any filename you want but the tyipcal filename is
PSScriptAnalyzerSettings.psd1.When using a relative path in a workspace settings file, the path is relative to the workspace root. If you put the setting in your user profile, it should be an absolute path.
rkeithhill commentedon Apr 28, 2018
Rob Holt (@rjmholt) I don't think this feature was designed to persist the set of selected rules between sessions. Another reason I prefer to use a PSSA settings file for the workspace.
bergmeister commentedon May 13, 2018
I think it is a minimum viable feature (for the moment) to tell people having to just edit the PSSA setting file themselves but of course, it could be improved. But what is a no go and problem is the fact that when no PSSA settings path is specified, the rules selected via Ctrl+Shift+P are not persisted!
I suggest that when selecting a rule AND the PSScriptAnalyzerSettingPath setting of VSCode is not set, then the extension should create such a file in the .vscode folder and make the Vscode setting point to it. Without this capability, the Vscode feature of selecting rules via Ctrl+Shift+P is useless and misleading. I myself saw this feature once and thought it would be nice to people who like to use GUIs, so I showed it at psconf.eu but not knowing that it does not persist because I personally use settings files...
I would also like to complain about the fact that not all rules are turned on by default, especially AvoidPossibleIncorrectComparisonWithNull.
mklement0 commentedon Nov 5, 2019
Good points, Christoph Bergmeister (@bergmeister).
There are both older and newer issues that are closely related:
#823 (David Wilson (@daviwil)) suggests adding support for persisting the existing GUI-based rules selection (
>PowerShell: Select PSScriptAnalyzer Rules)#1443 (Rob Holt (@rjmholt)) doesn't reference the GUI method, but proposes supporting persistent rule selection via
settings.jsonspecificallyAlso, there is another closely related issue that I decided to break out into a separate one:
If you use a relative path in setting
powershell.scriptAnalysis.settingsPath, for per-workspace settings, opening a workspace that doesn't have such a file quietly deactivates all rules - see #2287Also related: #2190, where TylerLeonhardt suggests automatically picking up a
PSScriptAnalyzerSettings.psd1file in the workspace root.