|
1 | 1 | @{
|
2 |
| - CustomRulePath = '.\output\RequiredModules\DscResource.AnalyzerRules' |
3 |
| - includeDefaultRules = $true |
4 |
| - IncludeRules = @( |
5 |
| - # DSC Resource Kit style guideline rules. |
6 |
| - 'PSAvoidDefaultValueForMandatoryParameter', |
7 |
| - 'PSAvoidDefaultValueSwitchParameter', |
8 |
| - 'PSAvoidInvokingEmptyMembers', |
9 |
| - 'PSAvoidNullOrEmptyHelpMessageAttribute', |
10 |
| - 'PSAvoidUsingCmdletAliases', |
11 |
| - 'PSAvoidUsingComputerNameHardcoded', |
12 |
| - 'PSAvoidUsingDeprecatedManifestFields', |
13 |
| - 'PSAvoidUsingEmptyCatchBlock', |
14 |
| - 'PSAvoidUsingInvokeExpression', |
15 |
| - 'PSAvoidUsingPositionalParameters', |
16 |
| - 'PSAvoidShouldContinueWithoutForce', |
17 |
| - 'PSAvoidUsingWMICmdlet', |
18 |
| - 'PSAvoidUsingWriteHost', |
19 |
| - 'PSDSCReturnCorrectTypesForDSCFunctions', |
20 |
| - 'PSDSCStandardDSCFunctionsInResource', |
21 |
| - 'PSDSCUseIdenticalMandatoryParametersForDSC', |
22 |
| - 'PSDSCUseIdenticalParametersForDSC', |
23 |
| - 'PSMisleadingBacktick', |
24 |
| - 'PSMissingModuleManifestField', |
25 |
| - 'PSPossibleIncorrectComparisonWithNull', |
26 |
| - 'PSProvideCommentHelp', |
27 |
| - 'PSReservedCmdletChar', |
28 |
| - 'PSReservedParams', |
29 |
| - 'PSUseApprovedVerbs', |
30 |
| - 'PSUseCmdletCorrectly', |
31 |
| - 'PSUseOutputTypeCorrectly', |
32 |
| - 'PSAvoidGlobalVars', |
33 |
| - 'PSAvoidUsingConvertToSecureStringWithPlainText', |
34 |
| - 'PSAvoidUsingPlainTextForPassword', |
35 |
| - 'PSAvoidUsingUsernameAndPasswordParams', |
36 |
| - 'PSDSCUseVerboseMessageInDSCResource', |
37 |
| - 'PSShouldProcess', |
38 |
| - 'PSUseDeclaredVarsMoreThanAssignments', |
39 |
| - 'PSUsePSCredentialType', |
| 2 | + CustomRulePath = @( |
| 3 | + './output/RequiredModules/DscResource.AnalyzerRules' |
| 4 | + './output/RequiredModules/Indented.ScriptAnalyzerRules' |
| 5 | + ) |
| 6 | + IncludeDefaultRules = $true |
| 7 | + IncludeRules = @( |
| 8 | + # DSC Community style guideline rules from the module ScriptAnalyzer. |
| 9 | + 'PSAvoidDefaultValueForMandatoryParameter' |
| 10 | + 'PSAvoidDefaultValueSwitchParameter' |
| 11 | + 'PSAvoidInvokingEmptyMembers' |
| 12 | + 'PSAvoidNullOrEmptyHelpMessageAttribute' |
| 13 | + 'PSAvoidUsingCmdletAliases' |
| 14 | + 'PSAvoidUsingComputerNameHardcoded' |
| 15 | + 'PSAvoidUsingDeprecatedManifestFields' |
| 16 | + 'PSAvoidUsingEmptyCatchBlock' |
| 17 | + 'PSAvoidUsingInvokeExpression' |
| 18 | + 'PSAvoidUsingPositionalParameters' |
| 19 | + 'PSAvoidShouldContinueWithoutForce' |
| 20 | + 'PSAvoidUsingWMICmdlet' |
| 21 | + 'PSAvoidUsingWriteHost' |
| 22 | + 'PSDSCReturnCorrectTypesForDSCFunctions' |
| 23 | + 'PSDSCStandardDSCFunctionsInResource' |
| 24 | + 'PSDSCUseIdenticalMandatoryParametersForDSC' |
| 25 | + 'PSDSCUseIdenticalParametersForDSC' |
| 26 | + 'PSMisleadingBacktick' |
| 27 | + 'PSMissingModuleManifestField' |
| 28 | + 'PSPossibleIncorrectComparisonWithNull' |
| 29 | + 'PSProvideCommentHelp' |
| 30 | + 'PSReservedCmdletChar' |
| 31 | + 'PSReservedParams' |
| 32 | + 'PSUseApprovedVerbs' |
| 33 | + 'PSUseCmdletCorrectly' |
| 34 | + 'PSUseOutputTypeCorrectly' |
| 35 | + 'PSAvoidGlobalVars' |
| 36 | + 'PSAvoidUsingConvertToSecureStringWithPlainText' |
| 37 | + 'PSAvoidUsingPlainTextForPassword' |
| 38 | + 'PSAvoidUsingUsernameAndPasswordParams' |
| 39 | + 'PSDSCUseVerboseMessageInDSCResource' |
| 40 | + 'PSShouldProcess' |
| 41 | + 'PSUseDeclaredVarsMoreThanAssignments' |
| 42 | + 'PSUsePSCredentialType' |
| 43 | + |
| 44 | + # Additional rules from the module ScriptAnalyzer |
| 45 | + 'PSUseConsistentWhitespace' |
| 46 | + 'UseCorrectCasing' |
| 47 | + 'PSPlaceOpenBrace' |
| 48 | + 'PSPlaceCloseBrace' |
| 49 | + 'AlignAssignmentStatement' |
| 50 | + 'AvoidUsingDoubleQuotesForConstantString' |
| 51 | + 'UseShouldProcessForStateChangingFunctions' |
40 | 52 |
|
| 53 | + # Rules from the modules DscResource.AnalyzerRules |
41 | 54 | 'Measure-*'
|
| 55 | + |
| 56 | + # Rules from the module Indented.ScriptAnalyzerRules |
| 57 | + 'AvoidCreatingObjectsFromAnEmptyString' |
| 58 | + 'AvoidDashCharacters' |
| 59 | + 'AvoidEmptyNamedBlocks' |
| 60 | + 'AvoidFilter' |
| 61 | + 'AvoidHelpMessage' |
| 62 | + 'AvoidNestedFunctions' |
| 63 | + 'AvoidNewObjectToCreatePSObject' |
| 64 | + 'AvoidParameterAttributeDefaultValues' |
| 65 | + 'AvoidProcessWithoutPipeline' |
| 66 | + 'AvoidSmartQuotes' |
| 67 | + 'AvoidThrowOutsideOfTry' |
| 68 | + 'AvoidWriteErrorStop' |
| 69 | + 'AvoidWriteOutput' |
| 70 | + 'UseSyntacticallyCorrectExamples' |
42 | 71 | )
|
43 | 72 |
|
| 73 | + <# |
| 74 | + The following types are not rules but parse errors reported by PSScriptAnalyzer |
| 75 | + so they cannot be ecluded. They need to be filtered out from the result of |
| 76 | + Invoke-ScriptAnalyzer. |
| 77 | +
|
| 78 | + TypeNotFound - Because classes in the project cannot be found unless built. |
| 79 | + RequiresModuleInvalid - Because 'using module' in prefix.ps1 cannot be resolved as source file. |
| 80 | + #> |
| 81 | + ExcludeRules = @() |
| 82 | + |
| 83 | + Rules = @{ |
| 84 | + PSUseConsistentWhitespace = @{ |
| 85 | + Enable = $true |
| 86 | + CheckOpenBrace = $true |
| 87 | + CheckInnerBrace = $true |
| 88 | + CheckOpenParen = $true |
| 89 | + CheckOperator = $false |
| 90 | + CheckSeparator = $true |
| 91 | + CheckPipe = $true |
| 92 | + CheckPipeForRedundantWhitespace = $true |
| 93 | + CheckParameter = $false |
| 94 | + } |
| 95 | + |
| 96 | + PSPlaceOpenBrace = @{ |
| 97 | + Enable = $true |
| 98 | + OnSameLine = $false |
| 99 | + NewLineAfter = $true |
| 100 | + IgnoreOneLineBlock = $false |
| 101 | + } |
| 102 | + |
| 103 | + PSPlaceCloseBrace = @{ |
| 104 | + Enable = $true |
| 105 | + NoEmptyLineBefore = $true |
| 106 | + IgnoreOneLineBlock = $false |
| 107 | + NewLineAfter = $true |
| 108 | + } |
| 109 | + |
| 110 | + PSAlignAssignmentStatement = @{ |
| 111 | + Enable = $true |
| 112 | + CheckHashtable = $true |
| 113 | + } |
| 114 | + } |
44 | 115 | }
|
0 commit comments