psake / PowerShellBuild

Common build tasks for psake and Invoke-Build that build and test PowerShell modules
MIT License
134 stars 24 forks source link

Not possible to disable PSScriptAnalyzer in properties #59

Open FLeven opened 2 years ago

FLeven commented 2 years ago

I chose to override some properties in pssake.ps1:

properties {

# Set this to $true to create a module with a monolithic PSM1
$PSBPreference.Build.CompileModule = $false
$PSBPreference.Help.DefaultLocale = 'en-US'
$PSBPreference.Test.OutputFile = 'out/testResults.xml'
# These settings overwrite values supplied from the PowerShellBuild
# module and govern how those tasks are executed
$PSBPreference.Test.ScriptAnalysisEnabled = $false
$PSBPreference.Test.CodeCoverage.Enabled  = $false
$PSBPreference.Publish.PSRepository = 'pwsh'
}

Expected Behavior

It should be possible to enable or disable CodeCoverage or PSScriptAnalyzer Tasks

Current Behavior

I can enable or disable CodeCoverage or override the name of the PSGallery used without any problem, but it is not possible to disable the PSScriptanalyzer as describe.

Possible Solution

For now I disable the Analyze Step in build.properties.ps1 on my build agent, because the Analyze Step fails ?randomly? from time to time.

Steps to Reproduce (for bugs)

  1. add $PSBPreference.Test.ScriptAnalysisEnabled = $false to pssake.ps1
  2. add $PSBPreference.Test.CodeCoverage.Enabled = $true to pssake.ps1
  3. Build

Context

Your Environment

Powershell 5.1 I always use all the required dependency's in the required version