GoodEnoughRules
A set of PSScriptAnalyzer rules that help make it Good Enough!
Badges
| Downloads | Version | Publish Status | Supported Platforms |
|---|---|---|---|
Overview
These are rules that "Good Enough" Gilbert, slapped together after seeing someone or something that wanted it. These may not be appropriate for the standard set of rules so keep that in mind.
You will probably want to enable individual rules vs all of them at once. I suggest taking a look at the documents to see what each rule does.
Installation
Install from the PowerShell Gallery:
Install-PSResource GoodEnoughRules
Documentation
The docs are automatically generated from the rule comment based help. You can see the docs at HeyItsGilbert.GitHub.io/GoodEnoughRules
Walk Through
[!TIP] Use a "proxy module" to load all your different custom rules and check that into your repository. This helps you avoid having to hardcode to a specific module path.
- Install the module.
-
Create a custom rule file:
PSScriptAnalyzerRules.psm1```pwsh
Proxy Module example
$rules = Import-Module -Name 'GoodEnoughRules' -PassThru Export-ModuleMember -Function @($rules.ExportedCommands.Keys) ```
-
Import it into your PSScriptAnalyzer config:
PSScriptAnalyzerSettings.psd1```pwsh @{ CustomRulePath = @( '.\PSScriptAnalyzerRules.psm1' )
IncludeDefaultRules = $true IncludeRules = @( # Default rules 'PSAvoidDefaultValueForMandatoryParameter' 'PSAvoidDefaultValueSwitchParameter' # Custom rules 'Measure-*' )} ```
If you're interested in learning more about the "Proxy Module" concept, see Sharing Your Custom PSScriptAnalyzer Rules
Using PSDepend
This module depends on PSScriptAnalyzer which means that it will install it
if's not available. If you have different required versions in your PSDepend
configuration that can cause conflict. I will try to avoid that by only
requiring a minimum version.