Skip to content

Commit 9ab94f4

Browse files
authored
Add enableCodeAnalyzersOnTestApps switch to Run-AlPipeline (#3292)
Add new switch on `Run-AlPipeline`, `enableCodeAnalyzersOnTestApps`, to enable CodeCops and other code analyzers on test apps. With these changes, the same analyzer-related settings will be used for both apps and test apps when running `Run-AlPipeline`.
1 parent ef8b276 commit 9ab94f4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

AppHandling/Run-AlPipeline.ps1

+5-2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@
148148
Include this switch to include UI Cop during compilation.
149149
.Parameter enablePerTenantExtensionCop
150150
Only relevant for Per Tenant Extensions. Include this switch to include Per Tenant Extension Cop during compilation.
151+
. Parameter enableCodeAnalyzersOnTestApps
152+
Include this switch to include CodeCops and other analyzers during compilation of test apps.
151153
.Parameter customCodeCops
152154
Use custom AL Cops into the container and include them, in addidtion to the default cops, during compilation.
153155
.Parameter useDefaultAppSourceRuleSet
@@ -341,6 +343,7 @@ Param(
341343
[switch] $enableAppSourceCop,
342344
[switch] $enableUICop,
343345
[switch] $enablePerTenantExtensionCop,
346+
[switch] $enableCodeAnalyzersOnTestApps,
344347
$customCodeCops = @(),
345348
[switch] $useDefaultAppSourceRuleSet,
346349
[string] $rulesetFile = "",
@@ -452,7 +455,6 @@ function GetInstalledAppIds {
452455
$installedApps = @(GetAppInfo -AppFiles $existingAppFiles -compilerFolder $compilerFolder -cacheAppinfoPath (Join-Path $packagesFolder 'cache_AppInfo.json'))
453456
$compilerFolderAppFiles = @(Get-ChildItem -Path (Join-Path $compilerFolder 'symbols/*.app') | Select-Object -ExpandProperty FullName)
454457
$installedApps += @(GetAppInfo -AppFiles $compilerFolderAppFiles -compilerFolder $compilerFolder -cacheAppinfoPath (Join-Path $compilerFolder 'symbols/cache_AppInfo.json'))
455-
456458
}
457459
elseif (!$filesOnly) {
458460
$installedApps = @(Invoke-Command -ScriptBlock $GetBcContainerAppInfo -ArgumentList $Parameters)
@@ -681,6 +683,7 @@ Write-Host -NoNewLine -ForegroundColor Yellow "enableCodeCop "
681683
Write-Host -NoNewLine -ForegroundColor Yellow "enableAppSourceCop "; Write-Host $enableAppSourceCop
682684
Write-Host -NoNewLine -ForegroundColor Yellow "enableUICop "; Write-Host $enableUICop
683685
Write-Host -NoNewLine -ForegroundColor Yellow "enablePerTenantExtensionCop "; Write-Host $enablePerTenantExtensionCop
686+
Write-Host -NoNewLine -ForegroundColor Yellow "enableCodeAnalyzersOnTestApps "; Write-Host $enableCodeAnalyzersOnTestApps
684687
Write-Host -NoNewLine -ForegroundColor Yellow "doNotPerformUpgrade "; Write-Host $doNotPerformUpgrade
685688
Write-Host -NoNewLine -ForegroundColor Yellow "doNotPublishApps "; Write-Host $doNotPublishApps
686689
Write-Host -NoNewLine -ForegroundColor Yellow "uninstallRemovedApps "; Write-Host $uninstallRemovedApps
@@ -1639,7 +1642,7 @@ Write-Host -ForegroundColor Yellow @'
16391642
}
16401643
}
16411644

1642-
if ($app) {
1645+
if ($app -or $enableCodeAnalyzersOnTestApps) {
16431646
$CopParameters += @{
16441647
"EnableCodeCop" = $enableCodeCop
16451648
"EnableAppSourceCop" = $enableAppSourceCop

ReleaseNotes.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Add support for useDevEndpoint in Run-AlPipeline when importing test toolkit
99
New function Get-AppJsonFromAppFile to extract the app.json file from an app (also from a runtime package)
1010
New function Copy-AppFilesToFolder to copy or download and unpack all apps from an array of .zip or .app files and place them in a folder
1111
New function Create-SymbolsFileFromAppFile to create a symbols only app file from an app file
12+
New switch on Run-AlPipeline, enableCodeAnalyzersOnTestApps, to enable CodeCops and other code analyzers on test apps
1213

1314
6.0.3
1415
Just-In-Time install dotnet 8.0.0 for Business Central version 24 or above (needed by alc.exe)

0 commit comments

Comments
 (0)