CodeFormattingOTBS settings preset always fails due to conflicting rules
See original GitHub issueSteps to reproduce
- Define a script that contains custom object syntax
# Build output object and add to array
$ServerArray += [PSCustomObject]@{
ComputerName = $VMName
vCenterName = $vCenter.name.Split('@')[1]
}
- Run PSScriptAnalyzer with the built-in ‘CodeFormattingOTBS’ settings preset.
Invoke-ScriptAnalyzer -path ./test.ps1 -Settings 'CodeFormattingOTBS'
-
Note that
PSAlignAssignmentStatement
rule throws a Warning. -
Correct error by aligning assignment statements.
# Build output object and add to array
$ServerArray += [PSCustomObject]@{
ComputerName = $VMName
vCenterName = $vCenter.name.Split('@')[1]
}
- Run PSScriptAnalyzer with the built-in ‘CodeFormattingOTBS’ settings preset again.
Invoke-ScriptAnalyzer -path ./test.ps1 -Settings 'CodeFormattingOTBS'
Expected behavior
No errors.
Actual behavior
PSUseConsistentWhitespace
throws an error due to the multiple spaces before the assignment operator =
.
This also happens when using the -Fix
parameter of Invoke-ScriptAnalyzer
. It will simply switch back and forth between the two errors each time you execute the command with -Fix
.
Environment data
MacOS Catalina 10.15.5
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
NVENC streaming Preset and Multipass Mode
Hi! I want to ask about these two settings: - Preset - Multipass mode I use NVENC and Preset P5: Slow (Good Quality)...
Read more >How to Fix OBS “Encoding Overloaded” Issue [2023]
Go to Settings, open the Video tab and lower the output resolution. Then select Common FPS Values and choose 30 or less. Open...
Read more >OBS Encoding Overloaded? Here are 9 Methods to Fix It
Method 2: Lower Frame Rate; Method 3: Change Encoder Preset; Method 4: Use Hardware Encoding; Method 5: Change Process Priority; Method 6: Close ......
Read more >Code Formatting | The IntelliJ IDEA Blog
Let's walk through setting specific formatting for use with Java 8 Streams. We'll change the settings so that Stream operations are always ......
Read more >IntelliJ IDEA: Coding style and code formatting
Code formatting in IDEA. After importing the project, press Ctrl+N and go to the AppTest class. This is the default test class. It...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This looks like a duplicate of #769, would you agree? I think a fix for this is not very easy because it involves both rules knowing about each other. A possible but expensive solution would be to try merge the rules together into one, which is something that even the previous maintainer of PSSA has suggested to do. cc @rjmholt as some food for thought for PSSA v2 API
This issue has been marked as duplicate and has not had any activity for 1 day. It will be closed for housekeeping purposes.