Lombiq / PowerShell-Analyzers

PowerShell code analyzers and code convention settings for Lombiq projects.
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Enable PSAlignAssignmentStatement analyzer rule (OSOE-538) #21

Open BenedekFarkas opened 1 year ago

BenedekFarkas commented 1 year ago

Factored out from #16.

PSAlignAssignmentStatement: The authors recommend this for readability and the auto-formatting in VS Code takes care of this when powershell.codeFormatting.alignPropertyValuePairs is enabled.

Jira issue

0liver commented 1 year ago

We don't align assignments in any other language we code in, so what would be the incentive to do it for PS?

BenedekFarkas commented 1 year ago

Readability. In C#, this mostly would mostly apply to object/collection initialization, but it's not that frequent (I don't know if there's an option to do the same, but I haven't checked either). For PS scripts, this is very common - multiple instances (with up to 6-8 parameters) in a script of even just a couple dozen lines due to parameter splatting.