-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathRuleToc.Doc.ps1
60 lines (49 loc) · 2.2 KB
/
RuleToc.Doc.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Document 'module' {
Title 'Rules by category'
Import-Module .\out\modules\PSRule.Rules.GitHub
$rules = Get-PSRule -Module PSRule.Rules.GitHub -Baseline Azure.All -WarningAction SilentlyContinue |
Add-Member -MemberType ScriptProperty -Name Category -Value { $this.Info.Annotations.category } -PassThru |
Sort-Object -Property Category;
Section 'Baselines' {
# 'The following baselines are included within `PSRule.Rules.GitHub`.'
}
Section 'Rules' {
'The following rules are included within `PSRule.Rules.GitHub`.'
$categories = $rules | Group-Object -Property Category;
foreach ($category in $categories) {
Section "$($category.Name)" {
$category.Group |
Sort-Object -Property RuleName |
Table -Property @{ Name = 'Name'; Expression = {
"[$($_.RuleName)]($($_.RuleName).md)"
}}, Synopsis, @{ Name = 'Severity'; Expression = {
$_.Info.Annotations.severity
}}
}
}
}
}
# Document 'resource' {
# Title 'Rules by resource'
# Import-Module .\out\modules\PSRule.Rules.GitHub
# $rules = Get-PSRule -Module PSRule.Rules.GitHub -Baseline GitHub -WarningAction SilentlyContinue |
# Add-Member -MemberType ScriptProperty -Name Resource -Value { $this.Info.Annotations.resource } -PassThru |
# Sort-Object -Property Resource;
# Section 'Rules' {
# 'The following rules are included within `PSRule.Rules.GitHub`.'
# $resources = $rules | Group-Object -Property Resource;
# foreach ($resource in $resources) {
# Section "$($resource.Name)" {
# $resource.Group |
# Sort-Object -Property RuleName |
# Table -Property @{ Name = 'Name'; Expression = {
# "[$($_.RuleName)]($($_.RuleName).md)"
# }}, Synopsis, @{ Name = 'Severity'; Expression = {
# $_.Info.Annotations.severity
# }}
# }
# }
# }
# }