@@ -465,28 +465,23 @@ task UpdateCBH {
465465task AnalyzeModuleRelease -if {$Script:BuildEnv.OptionAnalyzeCode} {
466466 Write-Description White 'Analyzing the project with ScriptAnalyzer' -accent
467467 $StageReleasePath = Join-Path (Join-Path $BuildRoot $Script:BuildEnv.ScratchFolder) $Script:BuildEnv.BaseReleaseFolder
468- $Analysis = Invoke-ScriptAnalyzer -Path $StageReleasePath
469- $AnalysisErrors = @($Analysis | Where-Object {@('Information', 'Warning') -notcontains $_.Severity})
470- if ($AnalysisErrors.Count -ne 0) {
471- Write-Build White 'The following errors came up in the script analysis:' -level 2
472- $AnalysisErrors
473- Write-Build
474- Write-Build White "Note that this was from the script analysis run against $StageReleasePath" -Level 2
475- Prompt-ForBuildBreak -CustomError $AnalysisErrors
468+ $Analysis = Invoke-ScriptAnalyzer -Path $StageReleasePath -Settings (Join-Path $BuildRoot "PSScriptAnalyzerSettings.psd1")
469+ if ($Analysis.Count) {
470+ Write-Description White "Note that this was from the script analysis run against $StageReleasePath" -level 2
471+ Write-Description Red "$($Analysis.Count) linting errors or warnings were found:" -level 2
472+ $Analysis | Format-Table -AutoSize
473+ Write-Error "$($Analysis.Count) linting errors or warnings were found. The build cannot continue." -ErrorAction Stop
476474 }
477475}
478476
479477# Synopsis: Run PSScriptAnalyzer against the public source files.
480478task AnalyzePublic {
481- Write-Description White 'Analyzing the public source files with ScriptAnalyzer.' -accent
482- $Analysis = Invoke-ScriptAnalyzer -Path (Join-Path $BuildRoot $Script:BuildEnv.PublicFunctionSource)
483- $AnalysisErrors = @($Analysis | Where-Object {@('Information', 'Warning') -notcontains $_.Severity})
484-
485- if ($AnalysisErrors.Count -ne 0) {
486- Write-Description White 'The following errors came up in the script analysis:' -level 2
487- $AnalysisErrors
488- Write-Description
479+ Write-Description White "Analyzing the public source files with ScriptAnalyzer." -accent
480+ $Analysis = Invoke-ScriptAnalyzer -Path (Join-Path $BuildRoot $Script:BuildEnv.PublicFunctionSource) -Settings (Join-Path $BuildRoot "PSScriptAnalyzerSettings.psd1")
481+ if ($Analysis.Count) {
489482 Write-Description White "Note that this was from the script analysis run against $($Script:BuildEnv.PublicFunctionSource)" -level 2
483+ Write-Description Red "$($Analysis.Count) linting errors or warnings were found:" -level 2
484+ $Analysis | Format-Table -AutoSize
490485 }
491486}
492487
@@ -883,13 +878,13 @@ task GithubPush VersionCheck, {
883878task . Configure, CodeHealthReport, Clean, PrepareStage, GetPublicFunctions, SanitizeCode, CreateHelp, CreateModulePSM1, CreateModuleManifest, AnalyzeModuleRelease, PushVersionRelease, PushCurrentRelease, CreateProjectHelp, PostBuildTasks, BuildSessionCleanup
884879
885880# Synopsis: Install and test load the module.
886- task InstallAndTestModule LoadBuildTools, InstallModule, TestInstalledModule
881+ task InstallAndTestModule InstallModule, TestInstalledModule
887882
888883# Synopsis: Build, Install, and Test the module
889884task BuildInstallAndTestModule Configure, CodeHealthReport, Clean, PrepareStage, GetPublicFunctions, SanitizeCode, CreateHelp, CreateModulePSM1, CreateModuleManifest, AnalyzeModuleRelease, PushVersionRelease, PushCurrentRelease, CreateProjectHelp, InstallModule, TestInstalledModule, PostBuildTasks, BuildSessionCleanup
890885
891886# Synopsis: Build, Install, Test, and Publish the module
892887task BuildInstallTestAndPublishModule Configure, CodeHealthReport, Clean, PrepareStage, GetPublicFunctions, SanitizeCode, CreateHelp, CreateModulePSM1, CreateModuleManifest, AnalyzeModuleRelease, PushVersionRelease, PushCurrentRelease, CreateProjectHelp, InstallModule, TestInstalledModule, PublishPSGallery, PostBuildTasks, BuildSessionCleanup
893888
894- # Synopsis: Insert Comment Based Help where it doesn't already exist (output to scratch directory)
889+ # Synopsis: Instert Comment Based Help where it doesn't already exist (output to scratch directory)
895890task InsertMissingCBH Configure, Clean, UpdateCBHtoScratch, BuildSessionCleanup
0 commit comments