Skip to content

Workaround PSSA #1187 by defaulting to NoIndentation #1816

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

Merged

Conversation

TylerLeonhardt
Copy link
Member

PR Summary

cc @bergmeister See PowerShell/PSScriptAnalyzer#1187 for more information.

v1.18.0 of PSSA introduced a regression. This changes the default behavior back to what v1.17 did while that is being addressed.

I will cherry pick this back to legacy once this is merged in.

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets.
Please mark anything not applicable to this PR NA.

  • PR has a meaningful title
  • Summarized changes
  • This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready

Copy link
Contributor

@rkeithhill rkeithhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@bergmeister bergmeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I was about to do this today but you were faster

@bergmeister
Copy link
Contributor

bergmeister commented Mar 27, 2019

Just to give a bit of background in case some people are concerned:

  1. PSScriptAnalyzer 1.17.1 did not handle multi-line pipelines well. With more than 2 lines the indentation was mostly inconsistent and I'd even say that the behaviour was ill-defined as the code did not cater for it at all.
  2. In 1.18.0 I improved it to handle multi-line pipelines. Because at this point I had to introduce logic where people might have different style preferences, I made the new multi-line behaviour configurable (i.e. the indentation after the first line), those are the 3 new settings: IncreaseIndentationAfterEveryPipeline, IncreaseIndentationForFirstPipeline and NoIndendation
  3. Unfortunately there are lots of cases to consider and although different test cases were written, there was one flaw in the logic in the case when the setting was IncreaseIndentationAfterEveryPipeline or IncreaseIndentationForFirstPipeline. This is the reason why changing the default to NoIndendation makes the bug not appear any more.
  4. The good news is that although users will not be able to use the first 2 settings (that might be more popular for most users), the behaviour will be as it was in PSSA 1.17.1, except that the multi-line behaviour will not be ill-defined as it used to be and therefore the bug fix that I did has still lead to some improvement, therefore this PR just means that part of a new feature will not be available right now until there is a fix in PSSA.

Concluding, it was unfortunate that this happened but at least with this we can protect the user's from it without any noticeable, negative impact, which shows that configurable settings or flags can really be helpful. Unfortunately there are many different cases and unfortunately some special ones are only found once it is in the wild. I hope that in the future, PSSA publishes preview releases (this is not entirely in my hand) and that user's are understandable, the feedback from users is very valuable though and we try to be as response as possible (in 1.17, a patch to the signing problem and a reported NullReferenceException was released only a few days later)

@TylerLeonhardt
Copy link
Member Author

Thanks for the detail @bergmeister 😊

@TylerLeonhardt TylerLeonhardt merged commit 64aba21 into PowerShell:master Mar 29, 2019
@TylerLeonhardt TylerLeonhardt deleted the workaround-PSSA-1187 branch March 29, 2019 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants