Skip to content

Provide a way to save rule list selected with "Select PSScriptAnalyzer Rules" menu #823

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

Open
daviwil opened this issue Jun 2, 2017 · 7 comments
Labels
Area-Configuration Issue-Enhancement A feature request (enhancement).

Comments

@daviwil
Copy link
Contributor

daviwil commented Jun 2, 2017

When the user uses the "Select PSScriptAnalyzer Rules" menu we currently don't persist those selections past the current session. We should provide an option in that menu which allows the user to save the current rule selection to a PSScriptAnalyzerSettings.psd1 file in their workspace path.

/cc @mattmcnabb

@daviwil daviwil added this to the July 2017 milestone Jun 2, 2017
@rkeithhill
Copy link
Contributor

And optionally create that file if it doesn't exist and wire it up through .vscode\settings.json. Yeah, that'd be nice too.

@daviwil
Copy link
Contributor Author

daviwil commented Jun 2, 2017

Yep, definitely. However, I'd prefer if we could just be smart and detect a PSScriptAnalyzerSettings.psd1 file in the workspace root without the user having to configure it. I think PSScriptAnalyzer does this already but I'm not sure.

@mattmcnabb
Copy link
Contributor

Thanks @daviwil! Weighing out whether I think it would be more valuable as a workspace setting or a user setting, if that's even feasible. Generally I would like the same rules turned on regardless of the project, but I can see how that may not be the right approach.

@rkeithhill
Copy link
Contributor

rkeithhill commented Jun 4, 2017

I'd prefer if we could just be smart and detect a PSScriptAnalyzerSettings.psd1 file in the workspace root without the user having to configure it.

Agreed as long as folks are OK that "by convention" we automatically find a file by that name. BTW is it PSScriptAnalyzerSettings.psd1 or ScriptAnalyzerSettings.psd1? And if the user chooses to use a different name (or location - perhaps in a subdir like src or source), then they'll have to tell us the path to the file.

I also like the idea that the UI mechanism is merely a UI over the corresponding settings file and not another way to manage rules.

Weighing out whether I think it would be more valuable as a workspace setting or a user setting

@mattmcnabb
If you work with more than one open source / GitHub PowerShell module, you'll pretty quickly come to the conclusion that workspace settings is the way to go. A) this file can be checked in and version controlled; B) with "user settings" you're on the hook to make sure the file exists and is configured correctly on multiple machines and C) not every project agrees upon the same settings. :-)

@mattmcnabb
Copy link
Contributor

@rkeithhill I see your point. I think the workspace file would be just fine, and it makes sense to include these settings with a project, to help encourage coding standards for all project contributors. I'm used to flying solo on projects so bad habits prevail ;)

Since I can use a settings file already, the UI itself is not that important to me. For my part, you can keep the menu in place or scrap it altogether. Mainly it just seemed counter-intuitive that the menu changed the settings but did not keep them. Seemed like a breach of contract.

@kevstev01
Copy link

Seemed like a breach of contract. +1

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Feb 5, 2020
@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Feb 6, 2020
@MarcoPeraza
Copy link

Just to offer my two cents, while supporting the full config file is good, shouldn't it also be directly exposed through vscode's json settings? The vast majority of users are just going to want to turn one or two checks off (probably PsAvoidUsingCmdletAliases).

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 2, 2020
@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Jun 2, 2020
@SydneyhSmith SydneyhSmith removed this from the Future milestone Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Configuration Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

7 participants