Skip to content

Update bundled PSScriptAnalyzer to v1.20.0 #3524

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
2 tasks done
andyleejordan opened this issue Aug 24, 2021 · 8 comments
Closed
2 tasks done

Update bundled PSScriptAnalyzer to v1.20.0 #3524

andyleejordan opened this issue Aug 24, 2021 · 8 comments
Assignees
Labels
Area-Script Analysis Issue-Enhancement A feature request (enhancement).

Comments

@andyleejordan
Copy link
Member

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.

Summary

We just got PSScriptAnalzyer v1.20.0 shipped, and so should update our bundled module!

Proposed Design

No response

@andyleejordan andyleejordan added the Issue-Enhancement A feature request (enhancement). label Aug 24, 2021
@andyleejordan andyleejordan added this to the Committed-vNext milestone Aug 24, 2021
@andyleejordan andyleejordan self-assigned this Aug 24, 2021
@andyleejordan
Copy link
Member Author

Resolved by PowerShell/PowerShellEditorServices#1562

@bergmeister
Copy link
Contributor

Will do a PR to expose new config options added in 1.20 here

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Aug 25, 2021
@andyleejordan
Copy link
Member Author

That'd be fantastic @bergmeister!

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Aug 25, 2021
@bergmeister
Copy link
Contributor

bergmeister commented Aug 25, 2021

No worries. Any ideas/preferences on naming the new setting? In PSSA land it is the IgnoreAssignmentOperatorInsideHashTable configuration of the UseConsistentWhitespace rule. We've almost always had a 1:1 mapping of rule config to vs code setting since vs code settings do not allow for structured settings but because users do not know about PSSA rules, a different name has been chosen so that users can understand a single setting by itself without having to understand the universe and also because the context of the parent rule name is missing...
https://github.com/PowerShell/PSScriptAnalyzer/blob/master/RuleDocumentation/UseConsistentWhitespace.md#ignoreassignmentoperatorinsidehashtable-bool-default-value-is-false
The description for the new setting I propose to be the same as the PSSA config but translated to VS-Code settings, which would be:

When whitespaceAroundOperator is enabled, ignore whitespace around assignment operators within multi-line hash tables. Set this option in order to use the alignPropertyValuePairs setting but still check whitespace around operators everywhere else.

Since it's quite complicated, I am leaning between not changing the setting name at all in this case or something like ignoreWhitespaceAroundAssignmentOperatorInsideHashTable? I know, quite a mouthful, what are your thoughts?

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Aug 25, 2021
@andyleejordan
Copy link
Member Author

I think I prefer keeping the names as close to the original as possible! It's a mouthful, but I don't see a better option.

@bergmeister
Copy link
Contributor

Had a go at testing it end to end and looked at test cases implemented for this new config option from a community member. Although it's an option of a 'formatting rule', it actually turns it out it has not materialistic impact on formatting itself. Let me explain: this PSSA setting was just added for the use case of people wanting to lint their formatting using Invoke-ScriptAnalyzer where 2 rule combinations were contradicting themselves. When it comes to formatting because of the magic way the formatter works (it iteratively re-runs formatting rules until it's happy), the red herring violation from the rule shows up in the end result of the formatted string luckily. So I guess the TL;DR is that we actually do not need to expose this new setting because it would not be of any value from a formatting perspective.... :-)

@andyleejordan
Copy link
Member Author

Haha, great! Thanks for doing that investigation, sure appreciate it. 🤩

@andyleejordan
Copy link
Member Author

It's updated in PSES, this will ship in the next preview!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Script Analysis Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

3 participants