Skip to content

Requirement to define the Default PSScriptAnalyzer ruleset & enable Custom (User Defined) rulesets in VSCode #270

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

Closed
kilasuit opened this issue Aug 30, 2016 · 4 comments
Labels
Issue-Discussion Let's talk about it.

Comments

@kilasuit
Copy link
Contributor

Following on from #246 I personally think that the default ruleset should be to include all Error & Warning Severity rules from PSScriptAnalyzer.

My reason behind this amounts to the following example

  • New user to PowerShell, perhaps on Windows or now on Linux
  • Likely to have copied someone else's script off of an online source (common scenario)
  • Helps them to improve script writing for use across multiple machines

However that being said I am aware of the issues with how rules are sometimes overpowering in their output within VSCode so if we can collectively agree a set of default rules then that would be a good start.

Also I've been trying to make use of the "powershell.scriptAnalysis.settingsPath" setting but this doesn't seem to be accepting any paths that I've been giving it.

@rkeithhill
Copy link
Contributor

rkeithhill commented Aug 30, 2016

Try adding a file called settings.json to your .vscode folder with this content:

{
    // Use a custom PowerShell Script Analyzer settings file for this workspace.
    // Relative paths for this setting are always relative to the workspace root dir.
    "powershell.scriptAnalysis.settingsPath": "./PSScriptAnalyzerSettings.psd1"
}

Then put a file called PSScriptAnalyzerSettings.psd1 in your workspace root folder (or under it somewhere - adjust the relative path above).

@daviwil
Copy link
Contributor

daviwil commented Aug 30, 2016

Hey Ryan, there might be a bug right now where the settings path you provide isn't being used. I'll file a separate issue for that.

@daviwil daviwil added the Issue-Discussion Let's talk about it. label Aug 30, 2016
@daviwil
Copy link
Contributor

daviwil commented Aug 30, 2016

New issue is #271

@kilasuit
Copy link
Contributor Author

think this has now been added in cc @tylerl0706

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Discussion Let's talk about it.
Projects
None yet
Development

No branches or pull requests

3 participants