diff --git a/.vscode/settings.json b/.vscode/settings.json index 38180b5894..cac3967c25 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,17 @@ { + "editor.formatOnSave": true, "files.trimTrailingWhitespace": true, "files.autoSave": "onFocusChange", "git.autofetch": true, "githubPullRequests.pullBranch": "always", + "powershell.codeFormatting.autoCorrectAliases": true, + "powershell.codeFormatting.newLineAfterCloseBrace": false, + "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline", + "powershell.codeFormatting.preset": "OTBS", + "powershell.codeFormatting.trimWhitespaceAroundPipe": true, + "powershell.codeFormatting.useConstantStrings": true, + "powershell.codeFormatting.useCorrectCasing": true, + "powershell.codeFormatting.whitespaceBetweenParameters": true, "[json,jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, @@ -12,5 +21,10 @@ "[markdown]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, - "editor.formatOnSave": true -} + "[powershell]": { + "editor.insertSpaces": true, + "editor.tabSize": 4, + "files.encoding": "utf8bom", + "files.insertFinalNewline": true + } +} \ No newline at end of file diff --git a/avm/res/compute/virtual-machine/tests/unit/avm.core.team.tests.ps1 b/avm/res/compute/virtual-machine/tests/unit/avm.core.team.tests.ps1 index c1e4211675..f0f36ce384 100644 --- a/avm/res/compute/virtual-machine/tests/unit/avm.core.team.tests.ps1 +++ b/avm/res/compute/virtual-machine/tests/unit/avm.core.team.tests.ps1 @@ -18,8 +18,7 @@ BeforeAll { if ($moduleFolderPaths.Count -gt 1) { $topLevelModuleTemplatePath = $moduleFolderPaths | Sort-Object | Select-Object -First 1 - } - else { + } else { $topLevelModuleTemplatePath = $moduleFolderPaths } diff --git a/avm/res/key-vault/vault/tests/e2e/max/tests/connectivity.tests.ps1 b/avm/res/key-vault/vault/tests/e2e/max/tests/connectivity.tests.ps1 index 9dd72e16bf..6ed0e8c83c 100644 --- a/avm/res/key-vault/vault/tests/e2e/max/tests/connectivity.tests.ps1 +++ b/avm/res/key-vault/vault/tests/e2e/max/tests/connectivity.tests.ps1 @@ -15,7 +15,7 @@ Describe 'Validate private endpoint deployment' { Context 'Validate sucessful deployment' { - It "Private endpoints should be deployed in resource group" { + It 'Private endpoints should be deployed in resource group' { $keyVaultResourceId = $TestInputData.DeploymentOutputs.resourceId.Value $testResourceGroup = ($keyVaultResourceId -split '\/')[4] @@ -36,4 +36,4 @@ Describe 'Validate private endpoint deployment' { $roleAssignments.Count | Should -BeGreaterThan 0 } } -} \ No newline at end of file +} diff --git a/avm/res/network/nat-gateway/tests/unit/avm.core.team.tests.ps1 b/avm/res/network/nat-gateway/tests/unit/avm.core.team.tests.ps1 index 8d3eb0180d..b491c25124 100644 --- a/avm/res/network/nat-gateway/tests/unit/avm.core.team.tests.ps1 +++ b/avm/res/network/nat-gateway/tests/unit/avm.core.team.tests.ps1 @@ -18,8 +18,7 @@ BeforeAll { if ($moduleFolderPaths.Count -gt 1) { $topLevelModuleTemplatePath = $moduleFolderPaths | Sort-Object | Select-Object -First 1 - } - else { + } else { $topLevelModuleTemplatePath = $moduleFolderPaths } diff --git a/avm/utilities/pipelines/e2eValidation/regionSelector/Get-AzAvailableResourceLocation.ps1 b/avm/utilities/pipelines/e2eValidation/regionSelector/Get-AzAvailableResourceLocation.ps1 index 3c6a479e55..fea03eb471 100644 --- a/avm/utilities/pipelines/e2eValidation/regionSelector/Get-AzAvailableResourceLocation.ps1 +++ b/avm/utilities/pipelines/e2eValidation/regionSelector/Get-AzAvailableResourceLocation.ps1 @@ -48,18 +48,18 @@ function Get-AzAvailableResourceLocation { [Parameter(Mandatory = $false)] [array] $ExcludedRegions = @( - "asiasoutheast", - "brazilsouth", - "eastus2", - "japaneast", - "koreacentral", - "qatercentral", - "southcentralus", - "switzerlandnorth", - "uaenorth", - "westeurope", - "westus2", - "westus2" + 'asiasoutheast', + 'brazilsouth', + 'eastus2', + 'japaneast', + 'koreacentral', + 'qatercentral', + 'southcentralus', + 'switzerlandnorth', + 'uaenorth', + 'westeurope', + 'westus2', + 'westus2' ) ) @@ -82,18 +82,17 @@ function Get-AzAvailableResourceLocation { $ResourceRegionList = (Get-AzResourceProvider | Where-Object { $_.ProviderNamespace -eq $formattedResourceProvider }).ResourceTypes | Where-Object { $_.ResourceTypeName -eq $formattedServiceName } | Select-Object -ExpandProperty Locations Write-Verbose "Region list: $($resourceRegionList | ConvertTo-Json)" - if ($resourceRegionList -eq "global" -or $null -eq $resourceRegionList) { + if ($resourceRegionList -eq 'global' -or $null -eq $resourceRegionList) { Write-Verbose "Resource is global or does not have a location in the Resource Providers API, default region [$GlobalResourceGroupLocation] will be used for resource group creation" $location = $GlobalResourceGroupLocation # Set Location to resource group location. Globabl resources should have hardocded location in `main.bicep` - } - else { + } else { $locations = Get-AzLocation | Where-Object { $_.DisplayName -in $ResourceRegionList -and $_.Location -notin $ExcludedRegions -and - $_.PairedRegion -ne "{}" -and - $_.RegionCategory -eq "Recommended" - } | Select-Object -ExpandProperty Location + $_.PairedRegion -ne '{}' -and + $_.RegionCategory -eq 'Recommended' + } | Select-Object -ExpandProperty Location Write-Verbose "Available Locations: $($locations | ConvertTo-Json)" $filteredAllowedLocations = @($locations | Where-Object { $_ -in $AllowedRegionsList }) diff --git a/avm/utilities/pipelines/e2eValidation/resourceDeployment/New-TemplateDeployment.ps1 b/avm/utilities/pipelines/e2eValidation/resourceDeployment/New-TemplateDeployment.ps1 index aba9f2ee19..cd4bf54c34 100644 --- a/avm/utilities/pipelines/e2eValidation/resourceDeployment/New-TemplateDeployment.ps1 +++ b/avm/utilities/pipelines/e2eValidation/resourceDeployment/New-TemplateDeployment.ps1 @@ -486,4 +486,4 @@ function New-TemplateDeployment { end { Write-Debug ('{0} exited' -f $MyInvocation.MyCommand) } -} \ No newline at end of file +} diff --git a/avm/utilities/pipelines/e2eValidation/resourceRemoval/helper/Invoke-ResourceLockRemoval.ps1 b/avm/utilities/pipelines/e2eValidation/resourceRemoval/helper/Invoke-ResourceLockRemoval.ps1 index ccd41cbceb..c554c701e2 100644 --- a/avm/utilities/pipelines/e2eValidation/resourceRemoval/helper/Invoke-ResourceLockRemoval.ps1 +++ b/avm/utilities/pipelines/e2eValidation/resourceRemoval/helper/Invoke-ResourceLockRemoval.ps1 @@ -68,6 +68,6 @@ function Invoke-ResourceLockRemoval { $resourceLock = Invoke-ResourceLockRetrieval -ResourceId $ResourceId -Type $Type $isLocked = $resourceLock.count -gt 0 } while ($isLocked) - + Write-Verbose (' [-] [{0}] resource lock(s) removed.' -f $resourceLock.count) -Verbose } diff --git a/avm/utilities/pipelines/e2eValidation/resourceRemoval/helper/Remove-Deployment.ps1 b/avm/utilities/pipelines/e2eValidation/resourceRemoval/helper/Remove-Deployment.ps1 index 8f17f66ff8..ee61d87d7a 100644 --- a/avm/utilities/pipelines/e2eValidation/resourceRemoval/helper/Remove-Deployment.ps1 +++ b/avm/utilities/pipelines/e2eValidation/resourceRemoval/helper/Remove-Deployment.ps1 @@ -152,8 +152,7 @@ function Remove-Deployment { if ($PSCmdlet.ShouldProcess(('[{0}] resources' -f (($resourcesToRemove -is [array]) ? $resourcesToRemove.Count : 1)), 'Remove')) { Remove-ResourceList -ResourcesToRemove $resourcesToRemove } - } - else { + } else { Write-Verbose 'Found [0] resources to remove' } } diff --git a/avm/utilities/pipelines/platform/Publish-ModuleFromTagToPBR.ps1 b/avm/utilities/pipelines/platform/Publish-ModuleFromTagToPBR.ps1 index 6e63338121..8d15039f1a 100644 --- a/avm/utilities/pipelines/platform/Publish-ModuleFromTagToPBR.ps1 +++ b/avm/utilities/pipelines/platform/Publish-ModuleFromTagToPBR.ps1 @@ -79,7 +79,7 @@ function Publish-ModuleFromTagToPBR { $publishInput = @( $moduleBicepFilePath - '--target', ("br:{0}/public/bicep/{1}:{2}" -f $plainPublicRegistryServer, $moduleRelativeFolderPath, $targetVersion) + '--target', ('br:{0}/public/bicep/{1}:{2}' -f $plainPublicRegistryServer, $moduleRelativeFolderPath, $targetVersion) '--documentationUri', $documentationUri '--with-source' '--force' @@ -87,7 +87,7 @@ function Publish-ModuleFromTagToPBR { Write-Verbose "Publish Input:`n $($publishInput | ConvertTo-Json -Depth 10)" -Verbose - if ($PSCmdlet.ShouldProcess("Module of tag [$ModuleReleaseTagName]", "Publish")) { + if ($PSCmdlet.ShouldProcess("Module of tag [$ModuleReleaseTagName]", 'Publish')) { bicep publish @publishInput } diff --git a/avm/utilities/pipelines/platform/Set-AvmGitHubIssueOwnerConfig.ps1 b/avm/utilities/pipelines/platform/Set-AvmGitHubIssueOwnerConfig.ps1 index c9b243ef20..7cce7865d1 100644 --- a/avm/utilities/pipelines/platform/Set-AvmGitHubIssueOwnerConfig.ps1 +++ b/avm/utilities/pipelines/platform/Set-AvmGitHubIssueOwnerConfig.ps1 @@ -22,31 +22,29 @@ Function Get-AvmCsvData { ) # CSV file URLs - $BicepResourceUrl = "https://aka.ms/avm/index/bicep/res/csv" - $BicepPatternUrl = "https://aka.ms/avm/index/bicep/ptn/csv" + $BicepResourceUrl = 'https://aka.ms/avm/index/bicep/res/csv' + $BicepPatternUrl = 'https://aka.ms/avm/index/bicep/ptn/csv' # Retrieve the CSV file switch ($ModuleIndex) { 'Bicep-Resource' { try { $unfilteredCSV = Invoke-WebRequest -Uri $BicepResourceUrl - } - catch { - Write-Error "Unable to retrieve CSV file - Check network connection." + } catch { + Write-Error 'Unable to retrieve CSV file - Check network connection.' } } 'Bicep-Pattern' { try { $unfilteredCSV = Invoke-WebRequest -Uri $BicepPatternUrl - } - catch { - Write-Error "Unable to retrieve CSV file - Check network connection." + } catch { + Write-Error 'Unable to retrieve CSV file - Check network connection.' } } } # Convert the CSV content to a PowerShell object - $formattedBicepFullCsv = ConvertFrom-CSV $unfilteredCSV.Content + $formattedBicepFullCsv = ConvertFrom-Csv $unfilteredCSV.Content # Loop through each item in the filtered data foreach ($item in $formattedBicepFullCsv) { @@ -92,14 +90,14 @@ function Set-AvmGitHubIssueOwnerConfig { $issue = gh issue view $IssueUrl.Replace('api.', '').Replace('repos/', '') --json 'author,title,url,body,comments' --repo $Repo | ConvertFrom-Json -Depth 100 if ($issue.title.StartsWith('[AVM Module Issue]')) { - $moduleName = ($issue.body.Split("`n") -match "avm/(?:res|ptn)")[0].Trim().Replace(' ', '') + $moduleName = ($issue.body.Split("`n") -match 'avm/(?:res|ptn)')[0].Trim().Replace(' ', '') if ([string]::IsNullOrEmpty($moduleName)) { throw 'No valid module name was found in the issue.' } - $moduleIndex = $moduleName.StartsWith("avm/res") ? "Bicep-Resource" : "Bicep-Pattern" - $module = Get-AvmCsvData -ModuleIndex $moduleIndex | Where-Object ModuleName -eq $moduleName + $moduleIndex = $moduleName.StartsWith('avm/res') ? 'Bicep-Resource' : 'Bicep-Pattern' + $module = Get-AvmCsvData -ModuleIndex $moduleIndex | Where-Object ModuleName -EQ $moduleName if ([string]::IsNullOrEmpty($module)) { throw "Module $moduleName was not found in $moduleIndex CSV file." @@ -113,11 +111,11 @@ A member of the @azure/$($module.ModuleOwnersGHTeam) or @azure/$($module.ModuleC if ($PSCmdlet.ShouldProcess("attention label to issue [$($issue.title)]", 'Add')) { # add labels - gh issue edit $issue.url --add-label "Needs: Attention :wave:" --repo $Repo + gh issue edit $issue.url --add-label 'Needs: Attention :wave:' --repo $Repo } if ($PSCmdlet.ShouldProcess("class label to issue [$($issue.title)]", 'Add')) { - gh issue edit $issue.url --add-label ($moduleIndex -eq "Bicep-Resource" ? "Class: Resource Module :package:" : "Class: Pattern Module :package:") --repo $Repo + gh issue edit $issue.url --add-label ($moduleIndex -eq 'Bicep-Resource' ? 'Class: Resource Module :package:' : 'Class: Pattern Module :package:') --repo $Repo } if ($PSCmdlet.ShouldProcess("reply comment to issue [$($issue.title)]", 'Add')) { @@ -139,4 +137,4 @@ A member of the @azure/$($module.ModuleOwnersGHTeam) or @azure/$($module.ModuleC } Write-Verbose ('issue {0}{1} updated' -f $issue.title, $($WhatIfPreference ? ' would have been' : '')) -} \ No newline at end of file +} diff --git a/avm/utilities/pipelines/platform/Set-AvmGithubIssueForWorkflow.ps1 b/avm/utilities/pipelines/platform/Set-AvmGithubIssueForWorkflow.ps1 index b2be286b00..1983b7aed4 100644 --- a/avm/utilities/pipelines/platform/Set-AvmGithubIssueForWorkflow.ps1 +++ b/avm/utilities/pipelines/platform/Set-AvmGithubIssueForWorkflow.ps1 @@ -55,7 +55,7 @@ function Set-AvmGithubIssueForWorkflow { $runId = $run.url.Split('/') | Select-Object -Last 1 $runDetails = gh run view $runId --json 'conclusion,number' --repo $Repo | ConvertFrom-Json -Depth 100 - if ($run.workflowName.StartsWith("avm.")) { + if ($run.workflowName.StartsWith('avm.')) { if (-not $workflowRuns.ContainsKey($run.workflowName) -or $runDetails.number -gt $workflowRuns[$run.workflowName].number) { $workflowRun = New-Object PSObject -Property @{ workflowName = $run.workflowName @@ -66,8 +66,7 @@ function Set-AvmGithubIssueForWorkflow { if (-not $workflowRuns.ContainsKey($run.workflowName)) { $workflowRuns.Add($run.workflowName, $workflowRun) - } - else { + } else { $workflowRuns[$run.workflowName] = $workflowRun } } @@ -86,8 +85,7 @@ function Set-AvmGithubIssueForWorkflow { } $issuesCreated++ - } - else { + } else { $issue = ($issues | Where-Object { $_.title -eq $issueName })[0] if (-not $issue.body.Contains($failedrun)) { @@ -97,8 +95,7 @@ function Set-AvmGithubIssueForWorkflow { } $issuesCommented++ - } - else { + } else { if (-not $issue.comments.body.Contains($failedrun)) { if ($PSCmdlet.ShouldProcess("Issue [$issueName]", 'Close')) { gh issue comment $issue.url --body $failedrun --repo $Repo @@ -109,8 +106,7 @@ function Set-AvmGithubIssueForWorkflow { } } } - } - else { + } else { $issueName = "[Failed pipeline] $($workflowRun.workflowName)" if ($issues.title -contains $issueName) { diff --git a/avm/utilities/pipelines/platform/Switch-WorkflowState.ps1 b/avm/utilities/pipelines/platform/Switch-WorkflowState.ps1 index 70ba58ac22..1d02a854e4 100644 --- a/avm/utilities/pipelines/platform/Switch-WorkflowState.ps1 +++ b/avm/utilities/pipelines/platform/Switch-WorkflowState.ps1 @@ -77,7 +77,7 @@ function Switch-WorkflowState { throw 'Function should not run for [Azure/bicep-registry-modules].' } - $workflows = gh workflow list --repo $repo --all --json "name,state,id" --limit 999 | ConvertFrom-Json -Depth 100 + $workflows = gh workflow list --repo $repo --all --json 'name,state,id' --limit 999 | ConvertFrom-Json -Depth 100 $relevantWorkflows = $workflows | Where-Object { $_.name -match $IncludePattern -and $_.name -notmatch $ExlcudePattern } diff --git a/avm/utilities/pipelines/publish/Publish-ModuleFromPathToPBR.ps1 b/avm/utilities/pipelines/publish/Publish-ModuleFromPathToPBR.ps1 index 9767b14faf..61c773f349 100644 --- a/avm/utilities/pipelines/publish/Publish-ModuleFromPathToPBR.ps1 +++ b/avm/utilities/pipelines/publish/Publish-ModuleFromPathToPBR.ps1 @@ -50,7 +50,7 @@ function Publish-ModuleFromPathToPBR { # 1. Test if module qualifies for publishing if (-not (Get-ModulesToPublish -ModuleFolderPath $moduleFolderPath)) { - Write-Verbose "No changes detected. Skipping publishing" -Verbose + Write-Verbose 'No changes detected. Skipping publishing' -Verbose return } @@ -95,7 +95,7 @@ function Publish-ModuleFromPathToPBR { $publishInput = @( $moduleBicepFilePath - '--target', ("br:{0}/public/bicep/{1}:{2}" -f $plainPublicRegistryServer, $publishedModuleName, $targetVersion) + '--target', ('br:{0}/public/bicep/{1}:{2}' -f $plainPublicRegistryServer, $publishedModuleName, $targetVersion) '--documentationUri', $documentationUri '--with-source' '--force' diff --git a/avm/utilities/pipelines/publish/helper/Get-ModuleReadmeLink.ps1 b/avm/utilities/pipelines/publish/helper/Get-ModuleReadmeLink.ps1 index 25c8f32320..323d7b715d 100644 --- a/avm/utilities/pipelines/publish/helper/Get-ModuleReadmeLink.ps1 +++ b/avm/utilities/pipelines/publish/helper/Get-ModuleReadmeLink.ps1 @@ -33,6 +33,6 @@ function Get-ModuleReadmeLink { [string] $RegistryBaseUri = 'https://github.com/Azure/bicep-registry-modules/tree' ) - $ModuleRelativeFolderPath = ("avm/{0}" -f ($ModuleFolderPath -split '[\/|\\]avm[\/|\\]')[-1]) -replace '\\', '/' + $ModuleRelativeFolderPath = ('avm/{0}' -f ($ModuleFolderPath -split '[\/|\\]avm[\/|\\]')[-1]) -replace '\\', '/' return (('{0}/{1}/{2}/README.md' -f $RegistryBaseUri, $TagName, $ModuleRelativeFolderPath) -replace '\\', '/') } diff --git a/avm/utilities/pipelines/publish/helper/Get-ModuleTargetPatchVersion.ps1 b/avm/utilities/pipelines/publish/helper/Get-ModuleTargetPatchVersion.ps1 index 42f8c2c45c..c1680db480 100644 --- a/avm/utilities/pipelines/publish/helper/Get-ModuleTargetPatchVersion.ps1 +++ b/avm/utilities/pipelines/publish/helper/Get-ModuleTargetPatchVersion.ps1 @@ -38,14 +38,14 @@ function Get-ModuleTargetPatchVersion { [string] $MajMinVersion ) - $ModuleRelativeFolderPath = ("avm/{0}" -f ($ModuleFolderPath -split '[\/|\\]avm[\/|\\]')[-1]) -replace '\\', '/' + $ModuleRelativeFolderPath = ('avm/{0}' -f ($ModuleFolderPath -split '[\/|\\]avm[\/|\\]')[-1]) -replace '\\', '/' # Get all released module tags (using upstream specifically to work in forks) $existingTagList = git ls-remote --tag 'https://github.com/Azure/bicep-registry-modules.git' "$ModuleRelativeFolderPath/$MajMinVersion*" if ( $existingTagList.count -eq 0 ) { # If first module tag, reset patch Write-Verbose "No existing tag for module [$ModuleRelativeFolderPath] starting with version [$MajMinVersion]" -Verbose - Write-Verbose "Setting patch version to 0" -Verbose + Write-Verbose 'Setting patch version to 0' -Verbose $patch = 0 } else { # Otherwise get latest patch diff --git a/avm/utilities/pipelines/publish/helper/Get-ModuleTargetVersion.ps1 b/avm/utilities/pipelines/publish/helper/Get-ModuleTargetVersion.ps1 index 480b67fb86..18d57a2660 100644 --- a/avm/utilities/pipelines/publish/helper/Get-ModuleTargetVersion.ps1 +++ b/avm/utilities/pipelines/publish/helper/Get-ModuleTargetVersion.ps1 @@ -48,12 +48,11 @@ function Get-ModuleTargetVersion { if ($versionChange) { # If [version.json] file version property was updated, reset the patch/bug version back to 0 - Write-Verbose "[version.json] file version property was updated. Resetting PATCH back to 0." -Verbose + Write-Verbose '[version.json] file version property was updated. Resetting PATCH back to 0.' -Verbose $patch = '0' - } - else { + } else { # Otherwise calculate the patch version - Write-Verbose "[version.json] file version property was not updated. Calculating new PATCH version." -Verbose + Write-Verbose '[version.json] file version property was not updated. Calculating new PATCH version.' -Verbose $patch = Get-ModuleTargetPatchVersion -ModuleFolderPath $ModuleFolderPath -MajMinVersion "$major.$minor" } diff --git a/avm/utilities/pipelines/publish/helper/Get-ModuleVersionChange.ps1 b/avm/utilities/pipelines/publish/helper/Get-ModuleVersionChange.ps1 index fc8458c772..10f905a3be 100644 --- a/avm/utilities/pipelines/publish/helper/Get-ModuleVersionChange.ps1 +++ b/avm/utilities/pipelines/publish/helper/Get-ModuleVersionChange.ps1 @@ -44,11 +44,11 @@ function Get-ModuleVersionChange { } if ($newVersion -lt $oldVersion) { - Write-Verbose "The new version is smaller than the old version" + Write-Verbose 'The new version is smaller than the old version' } elseif ($newVersion -eq $oldVersion) { - Write-Verbose "The new version equals the old version" + Write-Verbose 'The new version equals the old version' } else { - Write-Verbose "The new version is greater than the old version" + Write-Verbose 'The new version is greater than the old version' } if (-not [String]::IsNullOrEmpty($newVersion) -and -not [String]::IsNullOrEmpty($oldVersion)) { diff --git a/avm/utilities/pipelines/publish/helper/Get-ModulesToPublish.ps1 b/avm/utilities/pipelines/publish/helper/Get-ModulesToPublish.ps1 index 14e1a1401e..0ba3ef62cf 100644 --- a/avm/utilities/pipelines/publish/helper/Get-ModulesToPublish.ps1 +++ b/avm/utilities/pipelines/publish/helper/Get-ModulesToPublish.ps1 @@ -84,7 +84,7 @@ function Get-TemplateFileToPublish { [string[]] $PathsToInclude = @() ) - $ModuleRelativeFolderPath = ("avm/{0}" -f ($ModuleFolderPath -split '[\/|\\]avm[\/|\\]')[-1]) -replace '\\', '/' + $ModuleRelativeFolderPath = ('avm/{0}' -f ($ModuleFolderPath -split '[\/|\\]avm[\/|\\]')[-1]) -replace '\\', '/' $ModifiedFiles = Get-ModifiedFileList -Verbose Write-Verbose "Looking for modified files under: [$ModuleRelativeFolderPath]" -Verbose $modifiedModuleFiles = $ModifiedFiles.FullName | Where-Object { $_ -like "*$ModuleFolderPath*" } @@ -110,7 +110,7 @@ function Get-TemplateFileToPublish { Write-Verbose ('Modified modules found: [{0}]' -f $TemplateFilesToPublish.count) -Verbose $TemplateFilesToPublish | ForEach-Object { - $RelPath = ("avm/{0}" -f ($_ -split '[\/|\\]avm[\/|\\]')[-1]) -replace '\\', '/' + $RelPath = ('avm/{0}' -f ($_ -split '[\/|\\]avm[\/|\\]')[-1]) -replace '\\', '/' $RelPath = $RelPath.Split('/main.')[0] Write-Verbose " - [$RelPath]" -Verbose } diff --git a/avm/utilities/pipelines/publish/helper/New-ModuleReleaseTag.ps1 b/avm/utilities/pipelines/publish/helper/New-ModuleReleaseTag.ps1 index d8bfe0b8cc..58086e7671 100644 --- a/avm/utilities/pipelines/publish/helper/New-ModuleReleaseTag.ps1 +++ b/avm/utilities/pipelines/publish/helper/New-ModuleReleaseTag.ps1 @@ -28,7 +28,7 @@ function New-ModuleReleaseTag { [string] $TargetVersion ) - $ModuleRelativeFolderPath = ("avm/{0}" -f ($ModuleFolderPath -split '[\/|\\]avm[\/|\\]')[-1]) -replace '\\', '/' + $ModuleRelativeFolderPath = ('avm/{0}' -f ($ModuleFolderPath -split '[\/|\\]avm[\/|\\]')[-1]) -replace '\\', '/' # 1 Build Tag $tagName = '{0}/{1}' -f $ModuleRelativeFolderPath, $TargetVersion diff --git a/avm/utilities/pipelines/sharedScripts/Get-LocallyReferencedFileList.ps1 b/avm/utilities/pipelines/sharedScripts/Get-LocallyReferencedFileList.ps1 index caf99797c5..30a1368980 100644 --- a/avm/utilities/pipelines/sharedScripts/Get-LocallyReferencedFileList.ps1 +++ b/avm/utilities/pipelines/sharedScripts/Get-LocallyReferencedFileList.ps1 @@ -41,4 +41,4 @@ function Get-LocallyReferencedFileList { } return $resList -} \ No newline at end of file +} diff --git a/avm/utilities/pipelines/sharedScripts/Get-NestedResourceList.ps1 b/avm/utilities/pipelines/sharedScripts/Get-NestedResourceList.ps1 index d3ab354cc8..1f5e5389f2 100644 --- a/avm/utilities/pipelines/sharedScripts/Get-NestedResourceList.ps1 +++ b/avm/utilities/pipelines/sharedScripts/Get-NestedResourceList.ps1 @@ -44,7 +44,7 @@ function Get-NestedResourceList { if ($resource.type -eq 'Microsoft.Resources/deployments') { if ($resource.properties.template -is [System.Collections.Hashtable]) { $res += Get-NestedResourceList -TemplateFileContent $resource.properties.template - } + } } else { $res += Get-NestedResourceList -TemplateFileContent $resource } diff --git a/avm/utilities/pipelines/sharedScripts/Set-EnvironmentOnAgent.ps1 b/avm/utilities/pipelines/sharedScripts/Set-EnvironmentOnAgent.ps1 index 7f73fa7123..12de5cec07 100644 --- a/avm/utilities/pipelines/sharedScripts/Set-EnvironmentOnAgent.ps1 +++ b/avm/utilities/pipelines/sharedScripts/Set-EnvironmentOnAgent.ps1 @@ -170,7 +170,7 @@ function Set-EnvironmentOnAgent { Write-Verbose 'Preinstalled Bicep CLI version:' -Verbose bicep --version - Write-Verbose ("Install latest Bicep CLI") -Verbose + Write-Verbose ('Install latest Bicep CLI') -Verbose # Fetch the latest Bicep CLI binary curl -Lo bicep 'https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64' # Mark it as executable diff --git a/avm/utilities/pipelines/sharedScripts/Set-ModuleReadMe.ps1 b/avm/utilities/pipelines/sharedScripts/Set-ModuleReadMe.ps1 index fc28f922c3..deb6cb6ca5 100644 --- a/avm/utilities/pipelines/sharedScripts/Set-ModuleReadMe.ps1 +++ b/avm/utilities/pipelines/sharedScripts/Set-ModuleReadMe.ps1 @@ -542,7 +542,7 @@ function Set-DataCollectionSection { $telemetryUrl = 'https://aka.ms/avm/static/telemetry' try { $rawResponse = Invoke-WebRequest -Uri $telemetryUrl - if (($rawResponse.Headers['Content-Type'] | Out-String) -like "*text/plain*") { + if (($rawResponse.Headers['Content-Type'] | Out-String) -like '*text/plain*') { $telemetryFileContent = $rawResponse.Content -split '\n' } else { throw "Failed to telemetry information from [$telemetryUrl]." # Incorrect Url (e.g., points to HTML) @@ -1342,12 +1342,12 @@ function Set-UsageExamplesSection { $rawBicepExample = $rawContentArray[$bicepTestStartIndex..$bicepTestEndIndex] - if (-not ($rawBicepExample | Select-String ("\s+params:.*"))) { + if (-not ($rawBicepExample | Select-String ('\s+params:.*'))) { # Handle case where params are not provided $paramsBlockArray = @() } else { # Extract params block out of the Bicep example - $paramsStartIndex = ($rawBicepExample | Select-String ("\s+params:.*") | ForEach-Object { $_.LineNumber - 1 })[0] + $paramsStartIndex = ($rawBicepExample | Select-String ('\s+params:.*') | ForEach-Object { $_.LineNumber - 1 })[0] $paramsIndent = ($rawBicepExample[$paramsStartIndex] | Select-String '(\s+).*').Matches.Groups[1].Length @@ -1407,7 +1407,7 @@ function Set-UsageExamplesSection { $formattedBicepExample = @( "module $moduleNameCamelCase 'br/public:$($brLink):$($targetVersion)' = {", " name: '$($moduleNameCamelCase)Deployment'" - " params: {" + ' params: {' ) + $bicepExample + @( ' }', '}' diff --git a/avm/utilities/pipelines/sharedScripts/helper/Get-CrossReferencedModuleList.ps1 b/avm/utilities/pipelines/sharedScripts/helper/Get-CrossReferencedModuleList.ps1 index 713e2268c5..0d34d96f61 100644 --- a/avm/utilities/pipelines/sharedScripts/helper/Get-CrossReferencedModuleList.ps1 +++ b/avm/utilities/pipelines/sharedScripts/helper/Get-CrossReferencedModuleList.ps1 @@ -185,4 +185,4 @@ function Get-CrossReferencedModuleList { } return $resultSet -} \ No newline at end of file +} diff --git a/avm/utilities/pipelines/sharedScripts/tokenReplacement/Convert-TokensInFileList.ps1 b/avm/utilities/pipelines/sharedScripts/tokenReplacement/Convert-TokensInFileList.ps1 index dc619f1a41..bcae7411d6 100644 --- a/avm/utilities/pipelines/sharedScripts/tokenReplacement/Convert-TokensInFileList.ps1 +++ b/avm/utilities/pipelines/sharedScripts/tokenReplacement/Convert-TokensInFileList.ps1 @@ -101,8 +101,7 @@ function Convert-TokensInFileList { Convert-TokenInFile @ConvertTokenListFunctionInput $ConversionStatus = $true } - } - catch { + } catch { $ConversionStatus = $false Write-Verbose $_.Exception.Message -Verbose } diff --git a/avm/utilities/pipelines/sharedScripts/tokenReplacement/helper/Convert-TokenInFile.ps1 b/avm/utilities/pipelines/sharedScripts/tokenReplacement/helper/Convert-TokenInFile.ps1 index 7b8453e0ab..04081375eb 100644 --- a/avm/utilities/pipelines/sharedScripts/tokenReplacement/helper/Convert-TokenInFile.ps1 +++ b/avm/utilities/pipelines/sharedScripts/tokenReplacement/helper/Convert-TokenInFile.ps1 @@ -66,8 +66,7 @@ function Convert-TokenInFile { try { $File = Get-Content -Path $Path $FileName = Split-Path -Path $Path -Leaf - } - catch { + } catch { throw $PSItem.Exception.Message } Write-Verbose "Processing Tokens for file: $FileName" diff --git a/avm/utilities/pipelines/staticValidation/compliance/helper/helper.psm1 b/avm/utilities/pipelines/staticValidation/compliance/helper/helper.psm1 index a5103f9576..cd761d66a9 100644 --- a/avm/utilities/pipelines/staticValidation/compliance/helper/helper.psm1 +++ b/avm/utilities/pipelines/staticValidation/compliance/helper/helper.psm1 @@ -318,4 +318,4 @@ function Get-WorkflowEnvVariablesAsObject { } return $envVars -} \ No newline at end of file +} diff --git a/avm/utilities/pipelines/staticValidation/compliance/module.tests.ps1 b/avm/utilities/pipelines/staticValidation/compliance/module.tests.ps1 index 2c82eb4852..0d68e957d6 100644 --- a/avm/utilities/pipelines/staticValidation/compliance/module.tests.ps1 +++ b/avm/utilities/pipelines/staticValidation/compliance/module.tests.ps1 @@ -405,7 +405,7 @@ Describe 'Module tests' -Tag 'Module' { } } - Context "General" { + Context 'General' { It '[] The template file should not be empty.' -TestCases $moduleFolderTestCases { @@ -486,7 +486,7 @@ Describe 'Module tests' -Tag 'Module' { } } - Context "Parameters" { + Context 'Parameters' { It '[] The Location should be defined as a parameter, with the default value of "[resourceGroup().Location]" or "global" for ResourceGroup deployment scope.' -TestCases $moduleFolderTestCases { @@ -706,7 +706,7 @@ Describe 'Module tests' -Tag 'Module' { try { $rawResponse = Invoke-WebRequest -Uri $expectedUdtUrl - if (($rawResponse.Headers['Content-Type'] | Out-String) -like "*text/plain*") { + if (($rawResponse.Headers['Content-Type'] | Out-String) -like '*text/plain*') { $expectedSchemaFull = $rawResponse.Content -split '\n' } else { throw "Failed to fetch schema from [$expectedUdtUrl]. Skipping schema check" @@ -785,7 +785,7 @@ Describe 'Module tests' -Tag 'Module' { } } - Context "Variables" { + Context 'Variables' { It '[] Variable names should be camel-cased (no dashes or underscores and must start with lower-case letter).' -TestCases $moduleFolderTestCases { param( @@ -811,7 +811,7 @@ Describe 'Module tests' -Tag 'Module' { } } - Context "Resources" { + Context 'Resources' { It '[] Telemetry deployment should be present in the template.' -TestCases ($moduleFolderTestCases | Where-Object { $_.isTopLevelModule }) { param( @@ -825,7 +825,7 @@ Describe 'Module tests' -Tag 'Module' { $templateResources = $templateFileContent.resources.Keys | ForEach-Object { $templateFileContent.resources[$_] } } - $telemetryDeployment = $templateResources | Where-Object { $_.condition -like "*telemetry*" } # The AVM telemetry prefix + $telemetryDeployment = $templateResources | Where-Object { $_.condition -like '*telemetry*' } # The AVM telemetry prefix $telemetryDeployment | Should -Not -BeNullOrEmpty -Because 'A telemetry resource with name prefix [46d3xbcp] should be present in the template' } @@ -842,7 +842,7 @@ Describe 'Module tests' -Tag 'Module' { $templateResources = $templateFileContent.resources.Keys | ForEach-Object { $templateFileContent.resources[$_] } } - $telemetryDeployment = $templateResources | Where-Object { $_.condition -like "*telemetry*" } # The AVM telemetry prefix + $telemetryDeployment = $templateResources | Where-Object { $_.condition -like '*telemetry*' } # The AVM telemetry prefix if (-not $telemetryDeployment) { Set-ItResult -Skipped -Because 'Skipping this test as telemetry was not implemented in template' @@ -865,7 +865,7 @@ Describe 'Module tests' -Tag 'Module' { $templateResources = $templateFileContent.resources.Keys | ForEach-Object { $templateFileContent.resources[$_] } } - $telemetryDeployment = $templateResources | Where-Object { $_.condition -like "*telemetry*" } # The AVM telemetry prefix + $telemetryDeployment = $templateResources | Where-Object { $_.condition -like '*telemetry*' } # The AVM telemetry prefix if (-not $telemetryDeployment) { Set-ItResult -Skipped -Because 'Skipping this test as telemetry was not implemented in template' @@ -919,12 +919,12 @@ Describe 'Module tests' -Tag 'Module' { } else { $templateResources = $templateFileContent.resources.Keys | ForEach-Object { $templateFileContent.resources[$_] } } - $telemetryDeploymentName = ($templateResources | Where-Object { $_.condition -like "*telemetry*" }).name # The AVM telemetry prefix + $telemetryDeploymentName = ($templateResources | Where-Object { $_.condition -like '*telemetry*' }).name # The AVM telemetry prefix $telemetryDeploymentName | Should -Match "$expectedTelemetryIdentifier" } } - Context "Output" { + Context 'Output' { It '[] Output names should be camel-cased (no dashes or underscores and must start with lower-case letter).' -TestCases $moduleFolderTestCases { @@ -944,7 +944,7 @@ Describe 'Module tests' -Tag 'Module' { $CamelCasingFlag | Should -Not -Contain $false } - It "[] Output names description should start with a capital letter and contain text ending with a dot." -TestCases $moduleFolderTestCases { + It '[] Output names description should start with a capital letter and contain text ending with a dot.' -TestCases $moduleFolderTestCases { param( [hashtable] $templateFileContent @@ -1129,13 +1129,13 @@ Describe 'Governance tests' { $formattedEntry = $relativeModulePath -replace '\\', '\/' $moduleLine = $codeOwnersContent | Where-Object { $_ -match "^\s*\/$formattedEntry\/" } - $expectedEntry = "/{0}/ @Azure/{1}-module-owners-bicep @Azure/avm-core-team-technical-bicep" -f ($relativeModulePath -replace '\\', '/'), ($relativeModulePath -replace '-' -replace '[\\|\/]', '-') + $expectedEntry = '/{0}/ @Azure/{1}-module-owners-bicep @Azure/avm-core-team-technical-bicep' -f ($relativeModulePath -replace '\\', '/'), ($relativeModulePath -replace '-' -replace '[\\|\/]', '-') # Line should exist $moduleLine | Should -Not -BeNullOrEmpty -Because "the module should be listed in the [CODEOWNERS](https://azure.github.io/Azure-Verified-Modules/specs/shared/#codeowners-file) file as [/$expectedEntry]." # Line should be correct - $moduleLine | Should -Be $expectedEntry -Because "the module should match the expected format as documented [here](https://azure.github.io/Azure-Verified-Modules/specs/shared/#codeowners-file)." + $moduleLine | Should -Be $expectedEntry -Because 'the module should match the expected format as documented [here](https://azure.github.io/Azure-Verified-Modules/specs/shared/#codeowners-file).' } @@ -1464,4 +1464,4 @@ Describe 'API version tests' -Tag 'ApiCheck' { } } } -} \ No newline at end of file +} diff --git a/avm/utilities/pipelines/staticValidation/psrule/Set-PSRuleGitHubOutput.ps1 b/avm/utilities/pipelines/staticValidation/psrule/Set-PSRuleGitHubOutput.ps1 index f48a92bdb5..15a8561bf2 100644 --- a/avm/utilities/pipelines/staticValidation/psrule/Set-PSRuleGitHubOutput.ps1 +++ b/avm/utilities/pipelines/staticValidation/psrule/Set-PSRuleGitHubOutput.ps1 @@ -46,8 +46,8 @@ function Set-PSRuleGitHubOutput { return '' } else { $results = Import-Csv -Path $inputFilePath - $passedRules += $results | Where-Object { $_.Outcome -EQ 'Pass' } | Sort-Object -Property 'TargetName','RuleName' -Unique - $failedRules += $results | Where-Object { $_.Outcome -EQ 'Fail' } | Sort-Object -Property 'TargetName','RuleName' -Unique + $passedRules += $results | Where-Object { $_.Outcome -EQ 'Pass' } | Sort-Object -Property 'TargetName', 'RuleName' -Unique + $failedRules += $results | Where-Object { $_.Outcome -EQ 'Fail' } | Sort-Object -Property 'TargetName', 'RuleName' -Unique ###################### # Set output content # diff --git a/avm/utilities/tools/Invoke-WorkflowsForBranch.ps1 b/avm/utilities/tools/Invoke-WorkflowsForBranch.ps1 index 21c702e886..848b9864e6 100644 --- a/avm/utilities/tools/Invoke-WorkflowsForBranch.ps1 +++ b/avm/utilities/tools/Invoke-WorkflowsForBranch.ps1 @@ -237,7 +237,7 @@ function Invoke-WorkflowsForBranch { Write-Verbose 'Fetching current GitHub workflows' -Verbose $workflows = Get-GitHubModuleWorkflowList @baseInputObject -Filter $PipelineFilter - Write-Verbose ("Fetched [{0}] workflows" -f $workflows.Count) -Verbose + Write-Verbose ('Fetched [{0}] workflows' -f $workflows.Count) -Verbose if ($InvokeForDiff) { # Load used function @@ -287,4 +287,4 @@ function Invoke-WorkflowsForBranch { Write-Verbose '======================' -Verbose Write-Verbose ($gitHubWorkflowBadges | Sort-Object | Out-String) -Verbose } -} \ No newline at end of file +} diff --git a/avm/utilities/tools/Set-AVMModule.ps1 b/avm/utilities/tools/Set-AVMModule.ps1 index 1e437aad8d..a9d7872588 100644 --- a/avm/utilities/tools/Set-AVMModule.ps1 +++ b/avm/utilities/tools/Set-AVMModule.ps1 @@ -89,7 +89,7 @@ function Set-AVMModule { # Build up module file & folder structure if not yet existing. Should only run if an actual module path was provided (and not any of their parent paths) if (-not $SkipFileAndFolderSetup -and ((($resolvedPath -split '\bavm\b')[1].Trim('\,/') -split '[\/|\\]').Count -gt 2)) { - if ($PSCmdlet.ShouldProcess("File & folder structure for path [$resolvedPath]", "Setup")) { + if ($PSCmdlet.ShouldProcess("File & folder structure for path [$resolvedPath]", 'Setup')) { Set-ModuleFileAndFolderSetup -FullModuleFolderPath $resolvedPath } } @@ -157,7 +157,7 @@ Note: The 'Bicep CLI' version (bicep --version) is not the same as the 'Azure CL $telemetryUrl = 'https://aka.ms/avm/static/telemetry' try { $rawResponse = Invoke-WebRequest -Uri $telemetryUrl - if (($rawResponse.Headers['Content-Type'] | Out-String) -like "*text/plain*") { + if (($rawResponse.Headers['Content-Type'] | Out-String) -like '*text/plain*') { $TelemetryFileContent = $rawResponse.Content -split '\n' } else { throw "Failed to telemetry information from [$telemetryUrl]." # Incorrect Url (e.g., points to HTML) @@ -233,4 +233,4 @@ Note: The 'Bicep CLI' version (bicep --version) is not the same as the 'Azure CL $job | Remove-Job -Force -ErrorAction 'SilentlyContinue' } } -} \ No newline at end of file +} diff --git a/avm/utilities/tools/helper/Get-TemplateDeploymentWhatIf.ps1 b/avm/utilities/tools/helper/Get-TemplateDeploymentWhatIf.ps1 index 360d6818fc..af007046de 100644 --- a/avm/utilities/tools/helper/Get-TemplateDeploymentWhatIf.ps1 +++ b/avm/utilities/tools/helper/Get-TemplateDeploymentWhatIf.ps1 @@ -190,4 +190,4 @@ function Get-TemplateDeploymentWhatIf { end { Write-Debug ('{0} exited' -f $MyInvocation.MyCommand) } -} \ No newline at end of file +} diff --git a/avm/utilities/tools/helper/Set-ModuleFileAndFolderSetup.ps1 b/avm/utilities/tools/helper/Set-ModuleFileAndFolderSetup.ps1 index 43ecc69e7c..a73a589102 100644 --- a/avm/utilities/tools/helper/Set-ModuleFileAndFolderSetup.ps1 +++ b/avm/utilities/tools/helper/Set-ModuleFileAndFolderSetup.ps1 @@ -64,14 +64,14 @@ function Set-ModuleFileAndFolderSetup { # ------------- $bicepFilePath = Join-Path $CurrentLevelFolderPath 'main.bicep' if (-not (Test-Path $bicepFilePath)) { - if ($PSCmdlet.ShouldProcess("File [$bicepFilePath]", "Add")) { + if ($PSCmdlet.ShouldProcess("File [$bicepFilePath]", 'Add')) { $null = New-Item -Path $bicepFilePath -ItemType 'File' -Force } $defaultTemplateSourceFilePath = Join-Path $PSScriptRoot 'src' ($isTopLevel ? 'src.main.bicep' : 'src.child.main.bicep') if (Test-Path $defaultTemplateSourceFilePath) { $defaultTemplateSourceFileContent = Get-Content -Path $defaultTemplateSourceFilePath - if ($PSCmdlet.ShouldProcess("content for file [$bicepFilePath]", "Set")) { + if ($PSCmdlet.ShouldProcess("content for file [$bicepFilePath]", 'Set')) { $null = Set-Content -Path $bicepFilePath -Value $defaultTemplateSourceFileContent } } @@ -88,14 +88,14 @@ function Set-ModuleFileAndFolderSetup { # ------------ $versionFilePath = Join-Path $CurrentLevelFolderPath 'version.json' if (-not (Test-Path $versionFilePath)) { - if ($PSCmdlet.ShouldProcess("File [$versionFilePath]", "Add")) { + if ($PSCmdlet.ShouldProcess("File [$versionFilePath]", 'Add')) { $null = New-Item -Path $versionFilePath -ItemType 'File' -Force } $versionSourceFilePath = Join-Path $PSScriptRoot 'src' 'src.version.json' if (Test-Path $versionSourceFilePath) { $versionSourceFileContent = Get-Content -Path $versionSourceFilePath - if ($PSCmdlet.ShouldProcess("content for file [$versionFilePath]", "Set")) { + if ($PSCmdlet.ShouldProcess("content for file [$versionFilePath]", 'Set')) { $null = Set-Content -Path $versionFilePath -Value $versionSourceFileContent } } @@ -109,7 +109,7 @@ function Set-ModuleFileAndFolderSetup { if (($currentTestFolders -match '.*defaults').count -eq 0) { $defaultTestFilePath = Join-Path $testCasesPath 'default' 'main.test.bicep' - if ($PSCmdlet.ShouldProcess("file [$defaultTestFilePath]", "Add")) { + if ($PSCmdlet.ShouldProcess("file [$defaultTestFilePath]", 'Add')) { $null = New-Item -Path $defaultTestFilePath -ItemType 'File' -Force } $defaultTestTemplateSourceFilePath = Join-Path $PSScriptRoot 'src' 'src.main.test.bicep' @@ -122,7 +122,7 @@ function Set-ModuleFileAndFolderSetup { $suggestedResourceGroupName = $resourceTypeIdentifier -replace '[\/|\\]', '.' -replace '-' # e.g., network.privateendpoints $defaultTestTemplateSourceFileContent = $defaultTestTemplateSourceFileContent -replace '', $suggestedResourceGroupName - if ($PSCmdlet.ShouldProcess("content for file [$defaultTestFilePath]", "Set")) { + if ($PSCmdlet.ShouldProcess("content for file [$defaultTestFilePath]", 'Set')) { $null = Set-Content -Path $defaultTestFilePath -Value $defaultTestTemplateSourceFileContent } @@ -135,7 +135,7 @@ function Set-ModuleFileAndFolderSetup { # --------------------- if (($currentTestFolders -match '.*waf-aligned').count -eq 0) { $wafTestFilePath = Join-Path $testCasesPath 'waf-aligned' 'main.test.bicep' - if ($PSCmdlet.ShouldProcess("file [$wafTestFilePath]", "Add")) { + if ($PSCmdlet.ShouldProcess("file [$wafTestFilePath]", 'Add')) { $null = New-Item -Path $wafTestFilePath -ItemType 'File' -Force } @@ -149,7 +149,7 @@ function Set-ModuleFileAndFolderSetup { $suggestedResourceGroupName = $resourceTypeIdentifier -replace '[\/|\\]', '.' -replace '-' # e.g., network.privateendpoints $wafTestTemplateSourceFileContent = $wafTestTemplateSourceFileContent -replace '', $suggestedResourceGroupName - if ($PSCmdlet.ShouldProcess("content for file [$wafTestFilePath]", "Set")) { + if ($PSCmdlet.ShouldProcess("content for file [$wafTestFilePath]", 'Set')) { $null = Set-Content -Path $wafTestFilePath -Value $wafTestTemplateSourceFileContent } }