Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-833: Upgrade PSScriptAnalyzer to 1.22 #349

Merged
merged 8 commits into from
May 15, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $body = ConvertTo-Json $annotation -Compress
# Az CLI and Invoke-AzRestMethod both work in GitHub Actions, but Az throws various (inconsistent) errors in localhost.
Invoke-AzRestMethod -Path "$ApplicationInsightsResourceId/Annotations?api-version=2015-05-01" -Method PUT -Payload $body

if (!$?)
if (-not $?)
{
exit 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ dotnet build $SolutionOrProject @buildSwitches 2>&1 | ForEach-Object {
if ($noErrors) { Write-Output "::error file=$file,line=$line,col=$column::$message" }
}

if ($noErrors -and !$?)
if ($noErrors -and -not $?)
{
exit 1
}
Expand Down Expand Up @@ -122,4 +122,3 @@ if ($expectedErrorCodes)
Write-Output 'Verification complete, the solution or project only has the expected errors!'
exit 0
}

2 changes: 1 addition & 1 deletion .github/actions/publish-nuget/New-NuGetPackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function Get-ProjectProperty

$shouldDownloadBaseLinePackages = ($EnablePackageValidation -And
$PackageValidationBaselineVersion -And
!($Version -match '-(alpha|beta|preview|rc)[.-]') -And
-not ($Version -match '-(alpha|beta|preview|rc)[.-]') -And
$Version.Split('.')[0] -le $PackageValidationBaselineVersion.Split('.')[0])

$projects = (Test-Path *.sln) ? (dotnet sln list | Select-Object -Skip 2 | Get-Item) : (Get-ChildItem *.csproj)
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/test-dotnet/Invoke-SolutionTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ foreach ($test in $tests)

$processResult = StartProcessAndWaitForExit -FileName 'dotnet' -Arguments "test $($dotnetTestSwitches -join ' ')" -Timeout $TestProcessTimeout

if ($processResult.ExitCode -eq 0 -or (!$processResult.HasExited -and $processResult.HasTestRunSuccessfully))
if ($processResult.ExitCode -eq 0 -or (-not $processResult.HasExited -and $processResult.HasTestRunSuccessfully))
{
if (!$processResult.HasExited)
if (-not $processResult.HasExited)
{
Write-Output "::warning::The process $($processResult.ProcessId) for $test was killed but the tests were successful."
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ param(
[string] $Branch
)

if (!($Branch -match '(\w+-\d+)'))
if (-not ($Branch -match '(\w+-\d+)'))
{
exit
}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/validate-this-gha-refs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ jobs:
$output >> $env:GITHUB_OUTPUT

- name: Verify GitHub Actions Items Match Expected Ref (Pull & Approve/Merge PR)
if: (github.event_name == 'pull_request' || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || github.event_name == 'merge_group') && steps.add-prefix.outputs.prefixed-files != '@()'
# if: (github.event_name == 'pull_request' || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || github.event_name == 'merge_group') && steps.add-prefix.outputs.prefixed-files != '@()'
if: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's up with this change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, I guess this is wha the "Revert all action/workflow changes, except the list of expected analyzer violations" referred to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! It was because the script changes were detected by this workflow, but for this PR these are not relevant: https://github.com/Lombiq/GitHub-Actions/actions/runs/9096580468

uses: Lombiq/GitHub-Actions/.github/actions/verify-gha-refs@dev
with:
called-repo-base-include-list: '${{ steps.add-prefix.outputs.prefixed-files }}'
Expand Down
Loading