Skip to content

Commit f707bcd

Browse files
Refactor PSScriptAnalyzer tests to remove commented-out rule details and streamline settings structure
1 parent 4ad022d commit f707bcd

File tree

3 files changed

+39
-14
lines changed

3 files changed

+39
-14
lines changed

scripts/tests/PSScriptAnalyzer/PSScriptAnalyzer.Tests.ps1

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ BeforeDiscovery {
4444
Severity = $ruleObject.Severity
4545
Description = $ruleObject.Description
4646
Skip = $skip
47-
<#
48-
RuleName : PSDSCUseVerboseMessageInDSCResource
49-
CommonName : Use verbose message in DSC resource
50-
Description : It is a best practice to emit informative, verbose messages in DSC resource functions.
51-
This helps in debugging issues when a DSC configuration is executed.
52-
SourceType : Builtin
53-
SourceName : PSDSC
54-
Severity : Information
55-
ImplementingType : Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseVerboseMessageInDSCResource
56-
#>
5747
}
5848
)
5949
}

tests/srcTestRepo/tests/Custom.Settings.psd1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@{
2-
Rules = @{
2+
Rules = @{
33
PSAlignAssignmentStatement = @{
44
Enable = $true
55
CheckHashtable = $true
@@ -49,17 +49,17 @@
4949
IgnoreAssignmentOperatorInsideHashTable = $true
5050
}
5151
}
52-
ExcludeRules = @(
52+
ExcludeRules = @(
5353
'PSUseConsistentWhitespace'
5454
)
55-
IncludeRules = @(
55+
IncludeRules = @(
5656
'PSAvoidSemicolonsAsLineTerminators'
5757
'PSPlaceCloseBrace'
5858
'PSPlaceOpenBrace'
5959
'PSProvideCommentHelp'
6060
'PSUseConsistentIndentation'
6161
)
62-
Severity = @(
62+
Severity = @(
6363
'Error'
6464
'Warning'
6565
)

tools/records.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Schema: Get-ScriptAnalyzerRule
2+
3+
```plaintext
4+
RuleName : PSDSCUseVerboseMessageInDSCResource
5+
CommonName : Use verbose message in DSC resource
6+
Description : It is a best practice to emit informative, verbose messages in DSC resource functions.
7+
This helps in debugging issues when a DSC configuration is executed.
8+
SourceType : Builtin
9+
SourceName : PSDSC
10+
Severity : Information
11+
ImplementingType : Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.UseVerboseMessageInDSCResource
12+
```
13+
14+
## Schema: Invoke-ScriptAnalyzer ERROR record
15+
16+
```plaintext
17+
Line : 1
18+
Column : 1
19+
Message : The member 'ModuleVersion' is not present in the module manifest. This member must exist and be assigned a
20+
version number of the form 'n.n.n.n'. Add the missing member to the file
21+
' C:\Repos\GitHub\PSModule\Action\Test-PSModule\tests\srcWithManifestTestRepo\src\manifest.psd1'.
22+
Extent : @{
23+
Author = 'Author'
24+
}
25+
RuleName : PSMissingModuleManifestField
26+
Severity : Warning
27+
ScriptName : manifest.psd1
28+
ScriptPath : C:\Repos\GitHub\PSModule\Action\Test-PSModule\tests\srcWithManifestTestRepo\src\manifest.psd1
29+
RuleSuppressionID :
30+
SuggestedCorrections : {
31+
# Version number of this module.
32+
ModuleVersion = '1.0.0.0'
33+
}
34+
IsSuppressed : False
35+
```

0 commit comments

Comments
 (0)