PowerShellPracticeAndStyle
PowerShellPracticeAndStyle copied to clipboard
The Unofficial PowerShell Best Practices and Style Guide
## Given you're accepting a `$Path` parameter in your function... I think there are 4 scenarios, which are the flip sides of two conditions: ##### Condition One: Does it need...
I'm not sure where this belongs or if it even belongs in this repo but... Most of us probably have pretty complex profile scripts. My PSReadline custom configuration alone is...
Does anyone know of an add-on for the ISE that will display an indicator of some sort on a specified column? Without that, I don't think it's a good idea...
I love this project. I obsess over code formatting (not in a good way). Anyway, one thing I can't find mentioned is how to handle type accelerators with regards to...
In PowerShell v3, the ability to use Validation attributes on variables outside of parameters was added. It is mentioned here in the [New v3 Language Features](https://blogs.msdn.microsoft.com/powershell/2012/06/13/new-v3-language-features/) Page. Here are a...
In modern PowerShell, you should almost always avoid `New-Object`, because it is much slower than other methods of creating objects, like using the constructor directly via `::new(` or casting a...
It may be in general guidelines, but I could not find a general guideline on defining variables and I think there should be a section for this. Is it best...
https://github.com/PoshCode/PowerShellPracticeAndStyle/blob/master/Style%20Guide/English.md#functions I think the Style Guide should just say: > Always use CmdletBinding, because functions without CmdletBinding and common parameters do not behave the way users expect them to. They...
Hi. _Note: I really looked into the exisiting tickets before posting, but I might have overlooked something and included something you already discussed_ I am really exited about this repo...
https://github.com/PoshCode/PowerShellPracticeAndStyle/blob/master/Style%20Guide/English.md#when-using-advanced-functions-or-scripts-with-cmdletbinding-attribute-avoid-validating-parameters-in-the-body-of-the-script-when-possible-and-use---parameter-validation-attributes-instead I think the style guide should just have the text of this headline and a link to Best Practices for using validation and TypeAdapter attributes on parameters. > When...