question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PowerShell extension uses PSScriptAnalyzer settings file - Cannot update rules

See original GitHub issue

I had this error when doing: <ctrl>+<shift>+P, PSScript… image After Uninstall and reinstall the Powershell extension ( version 1.3.2, the same as it was before), there’s another issue: image

System Details

  • Operating system name and version: Windows 10.0.14393
  • VS Code version: 1.13.1
  • PowerShell extension version: 1.3.2
  • Output from $PSVersionTable: Name Value

PSVersion 5.1.14393.0 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} BuildVersion 10.0.14393.0 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1


PS C:\scripts> code -v
1.13.1
379d2efb5539b09112c793d3d9a413017d736f89
PS C:\scripts> $pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
1      3      2      0


PS C:\scripts> code --list-extensions --show-versions
ms-mssql.mssql@1.0.0
ms-vscode.PowerShell@1.3.2

Issue Description

I am experiencing a problem with PSScriptAnalyzer: cannot update the rules

Attached Logs

1497967294-c7966750-26b9-4c1a-88bf-382515625aa61497967292400.zip

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bergmeistercommented, 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.

1reaction
PorkyProgscommented, 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

PSScriptAnalyzer rules and recommendations - PowerShell
This article lists best-practice recommendations and the rules associated with them.
Read more >
PowerShell extension uses PSScriptAnalyzer settings file - Cannot ...
PowerShell extension uses PSScriptAnalyzer settings file - Cannot update rules.
Read more >
Applying custom rules in the vscode powershell extension ...
I'm attempting to do custom rules and code formatting (using the Format Document tool) with powershell in vscode.
Read more >
PowerShell/PSScriptAnalyzer - Gitter
I searched for Humanizer in the ps repo but could not find anything. ... this potential Invoke-Formatter issue and vscode: PowerShell/PSScriptAnalyzer#1055
Read more >
PowerShell Script Analyzer Community Rules in VS Code
You will now need to create a file to store the PSScriptAnalyzer settings. VSCode uses settings files to control the different settings of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found