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

Appearance settings

Unable to use both AlignAssignmentStatement and UseConsistentWhitespace rules #769

Copy link
Copy link
@gaudreaj

Description

@gaudreaj
Issue body actions

Hi,

It seems like it is not possible to use both AlignAssignmentStatement and UseConsistentWhitespace rules because the first contradicts the second. UseConsistentWhitespace is enforcing that only one space is used before the operator while AlignAssignmentStatement assert that all "=" operators are aligned. The only way the analyzer would not fail is that all the keys from the hashtable are the same length ;)

To reproduce:

  1. Create a script with the following code:
$hashtable = @{
    property1       = "value"
    anotherProperty = "another value"
}
  1. Run the analyzer with code formatting settings:
Invoke-ScriptAnalyzer -Path MyScript.ps1 -Settings CodeFormatting

You should see a PSUseConsistentWhitespace rule warning

No warning should be the expected result

tylerszabo, ralish and anniehedgpeth

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.