-
Notifications
You must be signed in to change notification settings - Fork 498
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
Missing Problems entries for PSUseToExportFieldsInManifest in .psd1 manifests #5112
Comments
@plmcgrn you may need to add this setting to your pssa config, here is an example https://github.com/PowerShell/vscode-powershell/blob/main/examples/PSScriptAnalyzerSettings.psd1 |
I'm well aware, but that's "just me", not "every developer committing code to a repo". |
You can place a PSScriptAnalyzer Settings file in a repo and add a settings.json to point to it if necessary to make it repo-wide. |
So place a |
Yep, you can also just open settings with |
Workspace-specific settings should generally not be gitignored if you want to provide a standard set of settings for a repository. Users should use a workspace file or profile with specific settings if they want to override it. |
Will this still work if a user has their local VS Code workspace configured as a multi-root workspace? Example:
|
Theoretically yes, but why not just test it to be sure? |
It doesn't work, based on my testing. My understanding is that multi-root configs only affect folder-specific settings, which these are not. I inferred that both based on this not working, as also that when using the native settings editor, this setting isn't visible in folder-specific settings, only Workspace and User. So if a user checks out one repo per-workspace, this would work, but if they check out multiple repo's, no joy. |
Looks like this would work if this issue's linked PR was merged. |
Prerequisites
Summary
When using VS Code and the PS extension for modifying manifests (.psd1 files), it seems that the extension doesn't surface PSScriptAnalyzer warnings for the PSUseToExportFieldsInManifest type.
https://learn.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/rules/usetoexportfieldsinmanifest?view=ps-modules
While somewhat related to the opposite intent of PowerShell/PSScriptAnalyzer#506 , where the user can take steps to override the warnings, I think in the case where these export rules contain wildcard (the default when using native tools to generate a manifest), this warning is relevant and should be surfaced.
PowerShell Version
Visual Studio Code Version
Extension Version
[email protected]
Steps to Reproduce
When running PSScriptAnalyzer with default settings like
Invoke-ScriptAnalyzer -Path ./ -Recurse
, I do get the warnings.But when opening the .psd1 manifest in VS Code, nothing is surfaced in the Problems pane.
Visuals
No response
Logs
No response
The text was updated successfully, but these errors were encountered: