Skip to content

Add new code formatting preset "OTPS": OTBS with else on new line#2158

Open
o-l-a-v wants to merge 2 commits intoPowerShell:mainfrom
o-l-a-v:feat/add-new-formatting-preset
Open

Add new code formatting preset "OTPS": OTBS with else on new line#2158
o-l-a-v wants to merge 2 commits intoPowerShell:mainfrom
o-l-a-v:feat/add-new-formatting-preset

Conversation

@o-l-a-v
Copy link

@o-l-a-v o-l-a-v commented Mar 1, 2026

PR Summary

This PR adds a new code formatting preset, "OTPS" (One True PowerShell Style): OTBS with else on new line.

Thoughts behind the name:

  • To mock the idea of one true formatting style, even though there are none.
  • We do ONE change from OTBS (else on new line), also in the name (change B with P).

Feature request:

Context:

PR Checklist

Tested like so

# Build
.\build.ps1 -PSVersion 7 -Configuration Release

# Import built module
Import-Module -Name './out/PSScriptAnalyzer\1.24.0\PSScriptAnalyzer.psd1'

# Test new preset with OTBS as input
Invoke-Formatter -Settings 'CodeFormattingOTPS' -ScriptDefinition (@'
enum Color {
    Black, 
    White
}

function Test-Code {
    [CmdletBinding()]
    param(
        [int]$ParameterOne
    )
    end {
        if (10 -gt $ParameterOne) {
            "Greater"
        } else {
            "Lesser"
        }
    }
}
'@)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant