@@ -67,21 +67,21 @@ if ($PSCmdlet.ParameterSetName -eq "Markdown") {
67
67
$MarkdownPath = Get-Content $MarkdownPaths
68
68
}
69
69
# When the input $MarkdownPaths is the path of a folder
70
- else {
70
+ else {
71
71
$MarkdownPath = $MarkdownPaths
72
72
}
73
- foreach ($_ in Get-ChildItem $MarkdownPath - Recurse:$Recurse.IsPresent ) {
73
+ foreach ($_ in Get-ChildItem $MarkdownPath - Recurse:$Recurse ) {
74
74
# Filter the .md of overview in "\help\"
75
75
if ((Get-Item - Path $_.FullName ).Directory.Name -eq " help" -and $_.FullName -cmatch " .*\.md" -and $_.BaseName -cmatch " ^[A-Z][a-z]+-([A-Z][a-z0-9]*)+$" ) {
76
- if ((Get-Item - Path $_.FullName ).Directory.Parent.Name -eq " netcoreapp3.1" ){
76
+ if ((Get-Item - Path $_.FullName ).Directory.Parent.Name -eq " netcoreapp3.1" ) {
77
77
continue
78
78
}
79
79
Write-Output " Searching in file $ ( $_.FullName ) ..."
80
- if ((Get-Item - Path $_.FullName ).Directory.Parent.Parent.Name -ne " src" ){
80
+ if ((Get-Item - Path $_.FullName ).Directory.Parent.Parent.Name -ne " src" ) {
81
81
$module = (Get-Item - Path $_.FullName ).Directory.Parent.Parent.Name
82
82
}
83
- else {
84
- $module = (Get-Item - Path $_.FullName ).Directory.Parent.Name
83
+ else {
84
+ $module = (Get-Item - Path $_.FullName ).Directory.Parent.Name
85
85
}
86
86
$cmdlet = $_.BaseName
87
87
$result = Measure-SectionMissingAndOutputScript $module $cmdlet $_.FullName `
@@ -92,31 +92,26 @@ if ($PSCmdlet.ParameterSetName -eq "Markdown") {
92
92
$totalLine = $result.TotalLine
93
93
}
94
94
}
95
- if (! $NotCleanScripts.IsPresent ){
96
- $codeMap | Export-Csv $TempScriptMapPath - NoTypeInformation
97
- }
95
+ $codeMap | Export-Csv $TempScriptMapPath - NoTypeInformation
98
96
}
99
97
100
98
# Analyze scripts
101
- if ($PSCmdlet.ParameterSetName -eq " Script" -or ! $SkipAnalyzing.IsPresent ) {
102
- if ($PSCmdlet.ParameterSetName -eq " Script" ){
103
- $codeMap = Merge-Scripts - ScriptPaths $ScriptPaths - Recurse:$Recurse.IsPresent - TempScriptPath $TempScriptPath
104
- if (! $NotCleanScripts.IsPresent ){
105
- $codeMap | Export-Csv $TempScriptMapPath - NoTypeInformation
106
- }
99
+ if ($PSCmdlet.ParameterSetName -eq " Script" -or ! $SkipAnalyzing ) {
100
+ if ($PSCmdlet.ParameterSetName -eq " Script" ) {
101
+ $codeMap = Merge-Scripts - ScriptPaths $ScriptPaths - Recurse:$Recurse - TempScriptPath $TempScriptPath
102
+ $codeMap | Export-Csv $TempScriptMapPath - NoTypeInformation
107
103
}
108
104
# Read and analyze ".ps1" in \ScriptsByExample
109
105
Write-Output " Analyzing file ..."
110
- $analysisResultsTable += Get-ScriptAnalyzerResult - ScriptPath $TempScriptPath - RulePaths $RulePaths - IncludeDefaultRules:$IncludeDefaultRules.IsPresent - CodeMap $codeMap - ErrorAction Continue
111
-
106
+ $analysisResultsTable += Get-ScriptAnalyzerResult - ScriptPath $TempScriptPath - RulePaths $RulePaths - IncludeDefaultRules:$IncludeDefaultRules - CodeMap $codeMap - ErrorAction Continue
107
+
112
108
# Summarize analysis results, output in Result.csv
113
- if ($analysisResultsTable ){
114
- $analysisResultsTable | Where-Object {$_ -ne $null } | Export-Csv " $PSScriptRoot \..\..\..\artifacts\StaticAnalysisResults\ExampleIssues.csv" - NoTypeInformation
109
+ if ($analysisResultsTable ) {
110
+ $analysisResultsTable | Where-Object { $_ -ne $null } | Export-Csv " $PSScriptRoot \..\..\..\artifacts\StaticAnalysisResults\ExampleIssues.csv" - NoTypeInformation
115
111
}
116
112
}
117
113
118
114
# Clean caches
119
- if (! $NotCleanScripts.IsPresent ) {
120
- Remove-Item $TempScriptPath - ErrorAction Continue
121
- Remove-Item $OutputFolder - ErrorAction SilentlyContinue
115
+ if (-not $NotCleanScripts ) {
116
+ Remove-Item $OutputFolder - Recurse - ErrorAction SilentlyContinue
122
117
}
0 commit comments