Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PSAvoidTrailingWhitespace: Rule not applied when using formatter + single character lines with trailing whitespace are truncated#1993

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@liamjpeters
Copy link
Contributor

@liamjpetersliamjpeters commentedApr 10, 2024
edited
Loading

PR Summary

PR Checklist

Ju-l1a reacted with heart emoji
…character, followed by multiple white-spaces were truncated when fixed/formatted
…ormatter with PSAvoidTrailingWhitespace and also checking that single-character lines that have trailing whitespace are not removed
@liamjpetersliamjpeters changed the titleWIP: PSAvoidTrailingWhitespace: Rule not applied when using formatter + single character lines with trailing whitespace are truncatedPSAvoidTrailingWhitespace: Rule not applied when using formatter + single character lines with trailing whitespace are truncatedApr 10, 2024
Copy link

@Ju-l1aJu-l1a left a comment

Choose a reason for hiding this comment

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

It works as expected now and all tests pass. Looks good to me!

@Ju-l1a
Copy link

Ju-l1a commentedJul 17, 2024
edited
Loading

I don't know if this is to do with this issue specifically but I've found that with this branch the fix forPSAvoidTrailingWhitespace gets applied when usingInvoke-ScriptAnalyzer -Fix ... but not when usingInvoke-Formatter .... I don't seem to have this problem for any other rules I've tried.

Edit: actually I'm getting the same forPSPossibleIncorrectComparisonWithNull.

@liamjpeters
Copy link
ContributorAuthor

Hey@Ju-l1a 👋,

You need to tell the formatter to include that rule when carrying out the formatting.

$Settings=@{IncludeRules=@("PSAvoidTrailingWhitespace")Rules=@{"PSAvoidTrailingWhitespace"=@{}    }}

So the below code, with lots of trailing whitespace:

$ScriptDef=@"    Function Get-Example {        'Example'`t`t`t    }`t`t`t"@

Is not altered when running:

Invoke-Formatter-ScriptDefinition$ScriptDef

image

But is fixed when running:

Invoke-Formatter-ScriptDefinition$ScriptDef-Settings$Settings

image

Hope that helps!

Copy link
Member

@andyleejordanandyleejordan left a comment

Choose a reason for hiding this comment

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

Thanks! Sorry it took so long to get to these.

@andyleejordanandyleejordan merged commitd6eb35e intoPowerShell:mainFeb 25, 2025
4 checks passed
@liamjpetersliamjpeters deleted the #1992PSAvoidTrailingWhitespaceNotApplied branchFebruary 25, 2025 09:16
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@andyleejordanandyleejordanandyleejordan approved these changes

@bergmeisterbergmeisterAwaiting requested review from bergmeisterbergmeister is a code owner

+1 more reviewer

@Ju-l1aJu-l1aJu-l1a approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

The PSAvoidTrailingWhitespace rule is not applied when using Invoke-Formatter Fixing PSAvoidTrailingWhitespace is broken

4 participants

@liamjpeters@Ju-l1a@andyleejordan@bergmeister

[8]ページ先頭

©2009-2025 Movatter.jp