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
{{ message }}
Repository navigation
Set Code Formatting: settings based on existing PSScriptAnalyzerSettings.psd1 so autoformat stays in sync with ScriptAnalyzer #4993
I have searched all issues to ensure it has not already been reported.
Summary
I need to have some PSScriptAnalyzer settings defined in a PSScriptAnalyzerSettings.psd1 so I can validate my code as part of CI. I also use VSCode, and keeping vscode settings and PSScriptAnalyzer settings in sync is a bit of a pain. Since PSScriptAnalyzer has a bunch of code formatting options supported, it would be great to be able to tell vscode to "format it the way Invoke-Formatter would.
With the following setup, running Invoke-ScriptAnalyzer -Settings ./PSScriptAnalyzerSettings.psd1 -Path ./test_file.ps1 -Fix does not result in any changes to the file. But if I hit Ctrl+S inside of vscode, the file is auto-formatted as follows:
Activity
JustinGrote commentedon May 21, 2024
Is there a specific issue with this setting that is not reading your settings file?

daprahamian commentedon May 22, 2024
Justin Grote (@JustinGrote) here is an example:
With the following setup, running
Invoke-ScriptAnalyzer -Settings ./PSScriptAnalyzerSettings.psd1 -Path ./test_file.ps1 -Fixdoes not result in any changes to the file. But if I hit Ctrl+S inside of vscode, the file is auto-formatted as follows:despite the fact that I have set