Skip to content

Commit 7243bb9

Browse files
author
Robin Stolpe
committed
Update
1 parent e4ffcb4 commit 7243bb9

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

RSModuleBuilder.ps1

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,22 @@ Set-Content -Path $outPSDFile -Value $PSDfileContent -Force
114114

115115
Write-Output "Running PSScriptAnalyzer on the .psd1 $($outPSDFile)..."
116116
# If no issue are found that should be written in the outfile
117-
$PSAnalyzerPSD = Invoke-ScriptAnalyzer -Path $outPSDFile -ReportSummary | select-object * | Out-File -Encoding UTF8BOM -FilePath $(Join-Path -Path $TestPath -ChildPath "PSScriptAnalyzer_psd1_$($TodaysDate).md")
117+
$PSAnalyzerPSD = Invoke-ScriptAnalyzer -Path $outPSDFile -ReportSummary
118+
if ($null -ne $PSAnalyzerPSD) {
119+
$PSAnalyzerPSD | select-object * | Out-File -Encoding UTF8BOM -FilePath $(Join-Path -Path $TestPath -ChildPath "PSScriptAnalyzer_psd1_$($TodaysDate).md")
120+
}
121+
else {
122+
Write-Output "0 rule violations found." | Out-File -Encoding UTF8BOM -FilePath $(Join-Path -Path $TestPath -ChildPath "PSScriptAnalyzer_psd1_$($TodaysDate).md")
123+
}
118124

119125
Write-Output "Running PSScriptAnalyzer on all .ps1 files in $($srcPublicFunctionPath)..."
120-
$PSAnalyzer = Invoke-ScriptAnalyzer -Path $srcPublicFunctionPath -Recurse -ReportSummary | select-object * | Out-File -Encoding UTF8BOM -FilePath $(Join-Path -Path $TestPath -ChildPath "PSScriptAnalyzer_ps1_$($TodaysDate).md")
126+
$PSAnalyzer = Invoke-ScriptAnalyzer -Path $srcPublicFunctionPath -Recurse -ReportSummary
127+
if ($null -ne $PSAnalyzer) {
128+
$PSAnalyzer | select-object * | Out-File -Encoding UTF8BOM -FilePath $(Join-Path -Path $TestPath -ChildPath "PSScriptAnalyzer_ps1_$($TodaysDate).md")
129+
}
130+
else {
131+
Write-Output "0 rule violations found." | Out-File -Encoding UTF8BOM -FilePath $(Join-Path -Path $TestPath -ChildPath "PSScriptAnalyzer_ps1_$($TodaysDate).md")
132+
}
121133

122134
# Import the module and save the Get-Help files to the $HelpPath for the module, files get saved in .md format
123135
Write-Verbose "Importing $($ModuleName) to the session..."
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0 rule violations found.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0 rule violations found.

0 commit comments

Comments
 (0)