Skip to content

Commit

Permalink
Scriptanalyzer fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
freddydk committed Aug 7, 2023
1 parent bbef0e3 commit 419b55c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
16 changes: 8 additions & 8 deletions Actions/AL-Go-Helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ function ReadSettings {
[string] $repoSettingsVariableValue = "$ENV:ALGoRepoSettings"
)

function GetSettingsObject {
function GetSettingsObject {
Param(
[string] $path
)
Expand Down Expand Up @@ -966,10 +966,10 @@ function AnalyzeRepo {
$settings.appDependencyProbingPaths = @($settings.appDependencyProbingPaths | ForEach-Object {
if ($_.GetType().Name -eq "PSCustomObject") {
$_
}
else {
}
else {
New-Object -Type PSObject -Property $_
}
}
})
$settings.appDependencyProbingPaths | ForEach-Object {
$dependency = $_
Expand Down Expand Up @@ -1044,7 +1044,7 @@ function AnalyzeRepo {
"appFolders", "testFolders" | ForEach-Object {
$propertyName = $_
Write-Host "Adding folders from $depProject to $_"
$found = $true
$found = $false
$depSettings."$propertyName" | ForEach-Object {
$folder = (Resolve-Path -Path (Join-Path $baseFolder "$depProject/$_") -Relative).ToLowerInvariant()
if (!$settings."$propertyName".Contains($folder)) {
Expand Down Expand Up @@ -1568,10 +1568,10 @@ function CreateDevEnv {
$repo.appDependencyProbingPaths = @($repo.appDependencyProbingPaths | ForEach-Object {
if ($_.GetType().Name -eq "PSCustomObject") {
$_
}
else {
}
else {
New-Object -Type PSObject -Property $_
}
}
})
Get-Dependencies -probingPathsJson $repo.appDependencyProbingPaths -saveToPath $dependenciesFolder -api_url 'https://api.github.com' | ForEach-Object {
if ($_.startswith('(')) {
Expand Down
10 changes: 5 additions & 5 deletions Actions/CalculateArtifactNames/CalculateArtifactNames.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-S
try {
$settings = $env:Settings | ConvertFrom-Json

if ($project -eq ".") {
$project = $settings.repoName
if ($project -eq ".") {
$project = $settings.repoName
}

$branchName = $branchName.Replace('\', '_').Replace('/', '_')
$projectName = $project.Replace('\', '_').Replace('/', '_')

# If the buildmode is default, then we don't want to add it to the artifact name
if ($buildMode -eq 'Default') {
$buildMode = ''
if ($buildMode -eq 'Default') {
$buildMode = ''
}
Set-OutputVariable -name "BuildMode" -value $buildMode

if ($suffix) {
# Add the date to the suffix
# Add the date to the suffix
$suffix = "$suffix-$([DateTime]::UtcNow.ToString('yyyyMMdd'))"
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ try {
$downloadedDependencies | ForEach-Object {
# naming convention: app, (testapp)
if ($_.startswith('(')) {
$DownloadedTestApps += $_
$DownloadedTestApps += $_
}
else {
$DownloadedApps += $_
$DownloadedApps += $_
}
}

Expand Down
2 changes: 1 addition & 1 deletion Actions/ReadSecrets/ReadSecrets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ try {
$settings.appDependencyProbingPaths | ForEach-Object {
if ($_.PsObject.Properties.name -eq "AuthTokenSecret") {
$secretsCollection += $_.authTokenSecret
}
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions Actions/VerifyPRChanges/VerifyPRChanges.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function ValidateFiles
if (($extension -in $disallowedExtensions) -or ($name -in $disallowedFiles) -or $filename.StartsWith(".github/")) {
throw "Pull Request containing changes to scripts, workflows or CODEOWNERS are not allowed from forks."
}
}
}
}

function ValidatePullRequest
Expand Down Expand Up @@ -79,11 +79,11 @@ $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-S
# IMPORTANT: All actions needs a try/catch here and not only in the yaml file, else they can silently fail

try {
$headers = @{
$headers = @{
"Authorization" = "token $token"
"Accept" = "application/vnd.github.baptiste-preview+json"
}

ValidatePullRequest -PullRequestRepository $prBaseRepository -PullRequestId $pullRequestId -Headers $headers
ValidatePullRequestFiles -PullRequestRepository $prBaseRepository -PullRequestId $pullRequestId -Headers $headers
}
Expand Down

0 comments on commit 419b55c

Please sign in to comment.