Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
Suppress warning in PSSA with custom rules - Fixes #176 (#181)
Browse files Browse the repository at this point in the history
* Fix issue 176 - suppress warning in PSSA with custom rules

* Changes as per PR comments
  • Loading branch information
PlagueHO authored and kwirkykat committed Aug 11, 2017
1 parent 5fb18b6 commit 4fc3d28
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ Invoke-AppveyorAfterTestTask `
variable for splatting.
* Enable so that missing required modules for integration tests is installed if
running in AppVeyor or show warning if run by user ([issue #168](https://github.com/PowerShell/DscResource.Tests/issues/168)).
* Set registry key HKLM:\Software\Microsoft\PowerShell\DisablePromptToUpdateHelp
to 1 when running in AppVeyor to suppress warning caused by running custom rules
in PSScriptAnalyzer in the GetExternalRule() method of `Engine/ScriptAnalyzer.cs`
([issue #176](https://github.com/PowerShell/DscResource.Tests/issues/176)).

### 0.2.0.0

Expand Down
18 changes: 18 additions & 0 deletions TestHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,24 @@ function Import-PSScriptAnalyzer

$psScriptAnalyzerModule = Get-Module -Name 'PSScriptAnalyzer' -ListAvailable

<#
When using custom rules in PSSA the Get-Help cmdlet gets
called by PSSA. This causes a warning to be thrown in AppVeyor.
This warning does not cause a failure or error, but causes
additional bloat to the analyzer output. To suppress this
the registry key
HKLM:\Software\Microsoft\PowerShell\DisablePromptToUpdateHelp
should be set to 1 when running in AppVeyor.
See this line from PSSA in GetExternalRule() method for more
information:
https://github.com/PowerShell/PSScriptAnalyzer/blob/development/Engine/ScriptAnalyzer.cs#L1120
#>
if ($env:APPVEYOR -eq $true)
{
Set-ItemProperty -Path HKLM:\Software\Microsoft\PowerShell -Name DisablePromptToUpdateHelp -Value 1
}

Import-Module -Name $psScriptAnalyzerModule
}

Expand Down

0 comments on commit 4fc3d28

Please sign in to comment.