-
Notifications
You must be signed in to change notification settings - Fork 392
Unable to use both AlignAssignmentStatement and UseConsistentWhitespace rules #769
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
Comments
You're right that the results they produce can be contradictory when dealing with property value pairs in a hashtable and that can be confusing. However, their original goal was to be used in succession - first However, given the current state I think it is best to ignore one of the rule or disable either |
Going forward, when we get a chance we can probably deprecate the @daviwil thoughts? |
Yep, it would be a cleaner approach to use a single rule for that. Sometimes we don't know until we get there :) |
This is quite ridiculous. https://github.com/PowerShell/PSScriptAnalyzer/blob/master/Engine/Settings/CodeFormatting.psd1 defines both as enabled. How can the supposed default style definition of PSSA have incompatible styles in it, 2 years after it was reported as not working. Is PSSA not dogfooding its own default style? The code in https://github.com/PowerShell/PSScriptAnalyzer/blob/master/Engine/Settings/CodeFormatting.psd1 fails when trying to format it with the "CodeFormatting" style, afaic. https://github.com/PowerShell/PSScriptAnalyzer/blob/master/Engine/Settings/CodeFormattingOTBS.psd1 has this highly ironic snippet PSUseConsistentWhitespace = @{
Enable = $true
CheckInnerBrace = $true
CheckOpenBrace = $true
CheckOpenParen = $true
CheckOperator = $true
CheckPipe = $true
CheckSeparator = $true
} Is nobody else using this style definitions? They seem to be documentation of rules according to outside pre-existing definitions and are not rules which are actually possible with the software, and are actually tested to work as a style definition (as opposed to unit tests of each piece in isolation of the others). Are any of the coding styles actually usable?
It seems like the quick "fix" is to admit reality, and disable |
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:
You should see a PSUseConsistentWhitespace rule warning
No warning should be the expected result
The text was updated successfully, but these errors were encountered: