From 9dafe170f195988c93879f249879a925d040d018 Mon Sep 17 00:00:00 2001 From: jhoneill Date: Mon, 23 Nov 2020 09:34:14 +0000 Subject: [PATCH] Suppress bogus analyzer warnings. --- __tests__/Export-Excel.Tests.ps1 | 6 +++++- __tests__/Join-Worksheet.tests.ps1 | 5 ++++- __tests__/RangePassing.Tests.ps1 | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/__tests__/Export-Excel.Tests.ps1 b/__tests__/Export-Excel.Tests.ps1 index 844998d..e778840 100644 --- a/__tests__/Export-Excel.Tests.ps1 +++ b/__tests__/Export-Excel.Tests.ps1 @@ -1,4 +1,8 @@ -Describe ExportExcel -Tag "ExportExcel" { +#Requires -Modules Pester +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments','',Justification='False Positives')] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable','',Justification='Only executes on versions without the automatic variable')] +param() +Describe ExportExcel -Tag "ExportExcel" { BeforeAll { if ($null -eq $IsWindows) { $IsWindows = [environment]::OSVersion.Platform -like "win*" } $WarningAction = "SilentlyContinue" diff --git a/__tests__/Join-Worksheet.tests.ps1 b/__tests__/Join-Worksheet.tests.ps1 index 2f744d3..f53d37e 100644 --- a/__tests__/Join-Worksheet.tests.ps1 +++ b/__tests__/Join-Worksheet.tests.ps1 @@ -1,4 +1,7 @@ -Describe "Join Worksheet part 1" { +#Requires -Modules Pester +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments','',Justification='False Positives')] +param() +Describe "Join Worksheet part 1" { BeforeAll { $data1 = ConvertFrom-Csv -InputObject @" ID,Product,Quantity,Price,Total diff --git a/__tests__/RangePassing.Tests.ps1 b/__tests__/RangePassing.Tests.ps1 index b166b96..bb460b5 100644 --- a/__tests__/RangePassing.Tests.ps1 +++ b/__tests__/RangePassing.Tests.ps1 @@ -1,3 +1,5 @@ +#Requires -Modules Pester +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments','',Justification='False Positives')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases','',Justification='Testing for presence of alias')] param()