From e2b8160de18233d2318dcfd376a2f420403eca93 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Sat, 29 May 2021 19:37:54 +1200 Subject: [PATCH 1/4] Fix CI pipeline --- CHANGELOG.md | 2 ++ appveyor.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc3d3d39..94f7fbe0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +* Fixed CI pipeline by limiting Pester module version to 4.10.1. + ## 2.12.0.0 * Ports style fixes that were recently made in xPSDesiredStateConfiguration diff --git a/appveyor.yml b/appveyor.yml index 1ad961fd..f593c403 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,7 @@ install: - ps: | $moduleName = 'PSDscResources' Import-Module "$env:APPVEYOR_BUILD_FOLDER\DscResource.Tests\AppVeyor.psm1" - Invoke-AppveyorInstallTask + Invoke-AppveyorInstallTask -PesterMaximumVersion 4.10.1 #---------------------------------# # build configuration # From 7d8c8344a7b99244f4e588f3858fd0ae91f3f47f Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Sat, 29 May 2021 20:48:25 +1200 Subject: [PATCH 2/4] Fix dev build badge --- CHANGELOG.md | 3 ++- README.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94f7fbe0..6449336c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## Unreleased -* Fixed CI pipeline by limiting Pester module version to 4.10.1. +* Fixed CI pipeline by limiting Pester module version to 4.10.1 - [Issue #199](https://github.com/PowerShell/PSDscResources/issues/199) +* Correct build badge for `dev` branch. ## 2.12.0.0 diff --git a/README.md b/README.md index c05d6ffa..dd01b6a7 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,8 @@ no contributions should be made directly to this branch. ### dev -[![Build status](https://ci.appveyor.com/api/projects/status/9nsi30ladk1jaax5/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/AuditPolicyDsc/branch/dev) -[![codecov](https://codecov.io/gh/PowerShell/AuditPolicyDsc/branch/dev/graph/badge.svg)](https://codecov.io/gh/PowerShell/AuditPolicyDsc/branch/dev) +[![Build status](https://ci.appveyor.com/api/projects/status/9uf3wyys7ky7776d/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/psdscresources/branch/dev) +[![codecov](https://codecov.io/gh/PowerShell/PSDscResources/branch/dev/graph/badge.svg)](https://codecov.io/gh/PowerShell/PSDscResources) This is the development branch to which contributions should be proposed by contributors as pull requests. From 641b965056206498e89bbfc0b8f66e3041c4b5d8 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Sat, 29 May 2021 20:59:44 +1200 Subject: [PATCH 3/4] Opt-in to meta tests --- .MetaTestOptIn.json | 7 +++++++ CHANGELOG.md | 8 ++++++++ .../MSFT_GroupResource/MSFT_GroupResource.psm1 | 8 ++++---- DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 | 10 ++++++---- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.MetaTestOptIn.json b/.MetaTestOptIn.json index 7f445ce5..18165d4f 100644 --- a/.MetaTestOptIn.json +++ b/.MetaTestOptIn.json @@ -1,4 +1,11 @@ [ + "Common Tests - Custom Script Analyzer Rules", + "Common Tests - Flagged Script Analyzer Rules", + "Common Tests - New Error-Level Script Analyzer Rules", + "Common Tests - Relative Path Length", + "Common Tests - Required Script Analyzer Rules", + "Common Tests - Validate Markdown Files", + "Common Tests - Validate Markdown Links", "Common Tests - Validate Module Files", "Common Tests - Validate Script Files", "Common Tests - Relative Path Length" diff --git a/CHANGELOG.md b/CHANGELOG.md index 6449336c..b4d7f1f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ * Fixed CI pipeline by limiting Pester module version to 4.10.1 - [Issue #199](https://github.com/PowerShell/PSDscResources/issues/199) * Correct build badge for `dev` branch. +* Opt-in to the following Meta tests: + * Common Tests - Custom Script Analyzer Rules. + * Common Tests - Flagged Script Analyzer Rules. + * Common Tests - New Error-Level Script Analyzer Rules. + * Common Tests - Relative Path Length. + * Common Tests - Required Script Analyzer Rules. + * Common Tests - Validate Markdown Links. + * Common Tests - Validate Markdown Files. ## 2.12.0.0 diff --git a/DscResources/MSFT_GroupResource/MSFT_GroupResource.psm1 b/DscResources/MSFT_GroupResource/MSFT_GroupResource.psm1 index 1efc25fb..57bc82a2 100644 --- a/DscResources/MSFT_GroupResource/MSFT_GroupResource.psm1 +++ b/DscResources/MSFT_GroupResource/MSFT_GroupResource.psm1 @@ -1003,7 +1003,7 @@ function Set-TargetResourceOnNanoServer #> foreach ($includedMember in $uniqueMembersToInclude) { - foreach($excludedMember in $uniqueMembersToExclude) + foreach ($excludedMember in $uniqueMembersToExclude) { if ($includedMember -eq $excludedMember) { @@ -1022,7 +1022,7 @@ function Set-TargetResourceOnNanoServer } } - foreach($excludedMember in $uniqueMembersToExclude) + foreach ($excludedMember in $uniqueMembersToExclude) { if ($groupMembers -contains $excludedMember) { @@ -1496,7 +1496,7 @@ function Test-TargetResourceOnNanoServer #> foreach ($includedMember in $uniqueMembersToInclude) { - foreach($excludedMember in $uniqueMembersToExclude) + foreach ($excludedMember in $uniqueMembersToExclude) { if ($includedMember -eq $excludedMember) { @@ -1515,7 +1515,7 @@ function Test-TargetResourceOnNanoServer } } - foreach($excludedMember in $uniqueMembersToExclude) + foreach ($excludedMember in $uniqueMembersToExclude) { if ($groupMembers -contains $excludedMember) { diff --git a/DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 b/DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 index 1a24fa00..762eab8d 100644 --- a/DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 +++ b/DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 @@ -329,10 +329,12 @@ function Set-TargetResource missing on some client SKUs (worked on both Server and Client Skus in Windows 10). #> $serverFeatureData = Invoke-CimMethod -Name 'GetServerFeature' ` - -Namespace 'root\microsoft\windows\servermanager' ` - -Class 'MSFT_ServerManagerTasks' ` - -Arguments @{ BatchSize = 256 } ` - -ErrorAction 'Ignore' + -Namespace 'root\microsoft\windows\servermanager' ` + -Class 'MSFT_ServerManagerTasks' ` + -Arguments @{ + BatchSize = 256 + } ` + -ErrorAction 'Ignore' $registryData = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction 'Ignore' From c4481ab0d4a116bfffa428e35eb743a6d494c849 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Sat, 29 May 2021 21:06:26 +1200 Subject: [PATCH 4/4] Fix style errors found by meta tests --- DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 | 3 ++- DscResources/MSFT_UserResource/MSFT_UserResource.psm1 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 b/DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 index 762eab8d..95c5fbbf 100644 --- a/DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 +++ b/DscResources/MSFT_MsiPackage/MSFT_MsiPackage.psm1 @@ -1,7 +1,8 @@ # Suppress Global Vars PSSA Error because $global:DSCMachineStatus must be allowed [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] -param() + +param () $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' diff --git a/DscResources/MSFT_UserResource/MSFT_UserResource.psm1 b/DscResources/MSFT_UserResource/MSFT_UserResource.psm1 index 7b7571f8..40e62492 100644 --- a/DscResources/MSFT_UserResource/MSFT_UserResource.psm1 +++ b/DscResources/MSFT_UserResource/MSFT_UserResource.psm1 @@ -353,6 +353,7 @@ function Get-TargetResourceOnFullSKU #> function Set-TargetResourceOnFullSKU { + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] [CmdletBinding(SupportsShouldProcess = $true)] param ( @@ -1125,7 +1126,7 @@ function Test-TargetResourceOnNanoServer if ($PSBoundParameters.ContainsKey('Password')) { - if(-not (Test-CredentialsValidOnNanoServer -UserName $UserName -Password $Password.Password)) + if (-not (Test-CredentialsValidOnNanoServer -UserName $UserName -Password $Password.Password)) { # The Password property does not match Write-Verbose -Message ($script:localizedData.PasswordPropertyMismatch -f 'Password')