Skip to content
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

Add .vscode PowerShell code formatting settings #1169

Closed
Badgerati opened this issue Oct 16, 2023 · 2 comments · Fixed by #1172
Closed

Add .vscode PowerShell code formatting settings #1169

Badgerati opened this issue Oct 16, 2023 · 2 comments · Fixed by #1172

Comments

@Badgerati
Copy link
Owner

Describe the Change

To help enforce the code formatting for Pode, specifically just the PowerShell scripts, a workspace settings for PowerShell code formatting should be created under a root .vscode folder.

  • This should mostly follow the style guide where possible, and the style guide updated where the settings can't match - such as bracers on new lines for functions and same line for statements, this had to all be on the same line.
  • The formatting should trigger on saving only, not while typing.
  • All main src PowerShell files should be re-formatted - this just overs files in /src, nothing else. Others will just happen over time.
  • The settings should be committed for others to utilise.
@Badgerati
Copy link
Owner Author

This is the code formatting I'm looking at going for - it should closely match the current guide in CONTRIBUTING:

{
    "editor.formatOnSave": true,
    "editor.formatOnType": false,
    "editor.minimap.enabled": false,
    "powershell.codeFormatting.addWhitespaceAroundPipe": true,
    "powershell.codeFormatting.alignPropertyValuePairs": true,
    "powershell.codeFormatting.autoCorrectAliases": true,
    "powershell.codeFormatting.avoidSemicolonsAsLineTerminators": true,
    "powershell.codeFormatting.ignoreOneLineBlock": false,
    "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline",
    "powershell.codeFormatting.trimWhitespaceAroundPipe": true,
    "powershell.codeFormatting.useConstantStrings": true,
    "powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
    "powershell.codeFormatting.whitespaceAroundOperator": true,
    "powershell.codeFormatting.whitespaceAfterSeparator": true,
    "powershell.codeFormatting.useCorrectCasing": false,
    "powershell.codeFormatting.openBraceOnSameLine": true,
    "powershell.codeFormatting.newLineAfterOpenBrace": true,
    "powershell.codeFormatting.newLineAfterCloseBrace": true,
    "powershell.codeFormatting.whitespaceBeforeOpenParen": true,
    "powershell.codeFormatting.whitespaceBetweenParameters": false,
    "powershell.codeFormatting.whitespaceInsideBrace": false
}

@Badgerati
Copy link
Owner Author

I tweaked the code formatting settings above slightly, and added files.trimTrailingWhitespace.

{
    "editor.formatOnSave": true,
    "editor.formatOnType": false,
    "editor.minimap.enabled": false,
    "powershell.codeFormatting.addWhitespaceAroundPipe": true,
    "powershell.codeFormatting.alignPropertyValuePairs": true,
    "powershell.codeFormatting.autoCorrectAliases": true,
    "powershell.codeFormatting.avoidSemicolonsAsLineTerminators": true,
    "powershell.codeFormatting.ignoreOneLineBlock": true,
    "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline",
    "powershell.codeFormatting.trimWhitespaceAroundPipe": true,
    "powershell.codeFormatting.useConstantStrings": true,
    "powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
    "powershell.codeFormatting.whitespaceAroundOperator": true,
    "powershell.codeFormatting.whitespaceAfterSeparator": true,
    "powershell.codeFormatting.useCorrectCasing": false,
    "powershell.codeFormatting.openBraceOnSameLine": true,
    "powershell.codeFormatting.newLineAfterOpenBrace": true,
    "powershell.codeFormatting.newLineAfterCloseBrace": true,
    "powershell.codeFormatting.whitespaceBeforeOpenParen": true,
    "powershell.codeFormatting.whitespaceBetweenParameters": false,
    "powershell.codeFormatting.whitespaceInsideBrace": true,
    "files.trimTrailingWhitespace": true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant