Skip to content

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

Open

Description

@daviwil

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 Matt McNabb (@mattmcnabb)

Activity

  1. rkeithhill commented on Jun 2, 2017

    @rkeithhill
    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.

  2. daviwil commented on Jun 2, 2017

    @daviwil
    ContributorAuthor

    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.

  3. mattmcnabb commented on Jun 2, 2017

    @mattmcnabb
    Contributor

    Thanks David Wilson (@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.

  4. rkeithhill commented on Jun 4, 2017

    @rkeithhill
    Contributor

    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

    Matt McNabb (@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. :-)

  5. mattmcnabb commented on Jun 5, 2017

    @mattmcnabb
    Contributor

    Keith Hill (@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.

  6. modified the milestones: July 2017, on Oct 26, 2017
  7. modified the milestone: on May 24, 2018
  8. kevstev01 commented on Feb 5, 2020

    @kevstev01

    Seemed like a breach of contract. +1

  9. MarcoPeraza commented on Jun 2, 2020

    @MarcoPeraza

    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).

  10. removed this from the milestone on Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions