Skip to content

Commit

Permalink
Merge pull request #36 from Lombiq/issue/OSOE-833
Browse files Browse the repository at this point in the history
OSOE-833: Upgrade PSScriptAnalyzer to 1.22
  • Loading branch information
sarahelsaig authored May 15, 2024
2 parents 2dc35d1 + a2f24b8 commit 2ad1948
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,18 @@ function Save-AzureWebAppSqlDatabaseToRepository

Process
{
if (!(Test-Path $RepositoryPath))
if (-not (Test-Path $RepositoryPath))
{
throw ("The folder `"$RepositoryPath`" can not be found!")
}

$destination = $RepositoryPath

if (!([string]::IsNullOrEmpty($RepositorySubPath)))
if (-not [string]::IsNullOrEmpty($RepositorySubPath))
{
$destination += "\$RepositorySubPath"

if (!(Test-Path $destination))
if (-not (Test-Path $destination))
{
New-Item -ItemType Directory -Path $destination -Force
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ function Set-AzureWebAppSqlDatabaseServiceObjective
$serviceObjectives = Get-AzSqlServerServiceObjective -ResourceGroupName $database.ResourceGroupName -ServerName $database.ServerName

$availableServiceObjectiveNames = $serviceObjectives |
Where-Object { !$PSItem.IsSystem -and $PSItem.Enabled } |
Where-Object { -not $PSItem.IsSystem -and $PSItem.Enabled } |
Select-Object -ExpandProperty 'ServiceObjectiveName'

if (!$availableServiceObjectiveNames.Contains($ServiceObjectiveName))
if (-not $availableServiceObjectiveNames.Contains($ServiceObjectiveName))
{
throw ("The `"$ServiceObjectiveName`" tier is not available for the server `"$($database.ServerName)`". " +
"The available tiers are:`n$([string]::Join(', ', $availableServiceObjectiveNames)).")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function Invoke-AzureWebAppStorageAzCopy
# Preparing to validate the list of source containers.
$containerIncludeListValid = $ContainerIncludeList -and $ContainerIncludeList.Count -gt 0
$sourceContainers = $sourceStorageContext | Get-AzStorageContainer |
Where-Object { !$containerIncludeListValid -or ($containerIncludeListValid -and $ContainerIncludeList.Contains($PSItem.Name)) }
Where-Object { -not $containerIncludeListValid -or ($containerIncludeListValid -and $ContainerIncludeList.Contains($PSItem.Name)) }
$sourceContainerNames = $sourceContainers | Select-Object -ExpandProperty 'Name'

# Throwing error if none of the source containers exist.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ function Save-AzureWebAppStorageContent

$containers = Get-AzStorageContainer -Context $storageContext |
Where-Object {
((!$containerWhiteListValid -or ($containerWhiteListValid -and $ContainerWhiteList.Contains($PSItem.Name))) -and
($containerWhiteListValid -or (!$containerBlackListValid -or !$ContainerBlackList.Contains($PSItem.Name))))
((-not $containerWhiteListValid -or ($containerWhiteListValid -and $ContainerWhiteList.Contains($PSItem.Name))) -and
($containerWhiteListValid -or (-not $containerBlackListValid -or -not $ContainerBlackList.Contains($PSItem.Name))))
}

$folderWhiteListValid = $FolderWhiteList -and $FolderWhiteList.Count -gt 0
Expand All @@ -149,10 +149,10 @@ function Save-AzureWebAppStorageContent
}
$blobs = $container | Get-AzStorageBlob |
Where-Object {
(!$folderWhiteListValid -or ($folderWhiteListValid -and
(-not $folderWhiteListValid -or ($folderWhiteListValid -and
(Compare-Object $PSItem.Name.Split('/', [StringSplitOptions]::RemoveEmptyEntries) $FolderWhiteList @comparisonParameters))) -and
(!$folderBlackListValid -or ($folderBlackListValid -and
(!(Compare-Object $PSItem.Name.Split('/', [StringSplitOptions]::RemoveEmptyEntries) $FolderBlackList @comparisonParameters))))
(-not $folderBlackListValid -or ($folderBlackListValid -and
(-not (Compare-Object $PSItem.Name.Split('/', [StringSplitOptions]::RemoveEmptyEntries) $FolderBlackList @comparisonParameters))))
}

foreach ($blob in $blobs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ function Set-AzureWebAppStorageContentFromStorage

$sourceContainers = $sourceStorageContext | Get-AzStorageContainer |
Where-Object {
((!$containerWhiteListValid -or ($containerWhiteListValid -and $ContainerWhiteList.Contains($PSItem.Name))) -and
($containerWhiteListValid -or (!$containerBlackListValid -or !$ContainerBlackList.Contains($PSItem.Name))))
((-not $containerWhiteListValid -or ($containerWhiteListValid -and $ContainerWhiteList.Contains($PSItem.Name))) -and
($containerWhiteListValid -or (-not $containerBlackListValid -or -not $ContainerBlackList.Contains($PSItem.Name))))
}
$sourceContainerNames = $sourceContainers | Select-Object -ExpandProperty 'Name'

Expand Down Expand Up @@ -237,7 +237,7 @@ function Set-AzureWebAppStorageContentFromStorage
Start-Sleep 5
}
}
while (!$containerCreated)
while (-not $containerCreated)
}

Write-Output ("`n*****`nCopying blobs from `"$($sourceContainer.Name)`" to `"$destinationContainerName`"`n*****")
Expand All @@ -257,10 +257,10 @@ function Set-AzureWebAppStorageContentFromStorage
ExcludeDifferent = $true
}

if ((!$folderWhiteListValid -or
if ((-not $folderWhiteListValid -or
($folderWhiteListValid -and (Compare-Object $blobNameElements $FolderWhiteList @comparisonParameters))) -and
(!$folderBlackListValid -or
($folderBlackListValid -and (!(Compare-Object $blobNameElements $FolderBlackList @comparisonParameters)))))
(-not $folderBlackListValid -or
($folderBlackListValid -and (-not (Compare-Object $blobNameElements $FolderBlackList @comparisonParameters)))))
{
$copyParameters = @{
Context = $sourceStorageContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ function UpdateWebAppSlotAppSettingsAndConnectionStrings
Write-Warning "Attempt #$retryCounter to update the `"$SlotName`" Slot of `"$WebAppName`" failed. Retrying..."
}
}
while (!$success)
while (-not $success)

return $slot
}
Expand Down Expand Up @@ -533,7 +533,7 @@ function VerifyAppSettingsValidity
}
}

if (!$appSettingsValid)
if (-not $appSettingsValid)
{
Write-Error ("`n*****`nERROR: THE `"$SlotName`" SLOT'S APP SETTINGS ARE INVALID!`n*****`n")
}
Expand Down Expand Up @@ -585,7 +585,7 @@ function VerifyConnectionStringsValidity
}
}

if (!$connectionStringsValid)
if (-not $connectionStringsValid)
{
Write-Error ("`n*****`nERROR: THE `"$SlotName`" SLOT'S CONNECTION STRINGS ARE INVALID!`n*****`n")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function Get-Maintenance
Write-Warning "Requesting the status of the maintenance `"$MaintenanceName`" at `"$Hostname`" failed. Retrying..."
}
}
while (!$success)
while (-not $success)

if ($result.StatusCode -eq 200)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function Start-Maintenance
Write-Warning "Starting the maintenance `"$MaintenanceName`" at `"$Hostname`" failed. Retrying..."
}
}
while (!$success)
while (-not $success)

if ($result.StatusCode -ne 201)
{
Expand Down
2 changes: 1 addition & 1 deletion PowerShell/TeamCity/Start-TCBuild/Start-TCBuild.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
Write-Warning "Triggering `"$BuildId`" failed. Retrying..."
}
}
while (!$success)
while (-not $success)

Write-Output "Successfully triggered `"$BuildId`"!"
}
Expand Down
2 changes: 1 addition & 1 deletion PowerShell/Utilities/Test-Url/Test-Url.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function Test-Url
Start-Sleep -Seconds $Interval
}
}
while (!$success)
while (-not $success)

return $success
}
Expand Down

0 comments on commit 2ad1948

Please sign in to comment.