Skip to content

Commit e366e45

Browse files
so that we stop if one or all of the checks are not yet converted
1 parent bbee39c commit e366e45

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

source/functions/Invoke-DbcCheck.ps1

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,19 @@ function Invoke-DbcCheck {
374374
if ($PassThru) {
375375
$configuration.Run.PassThru = $true
376376
}
377-
# So that if the only check passed in is not yet converted - so that we dont get red.
378-
if ($check -in $notv5) {
379-
Write-PSFMessage -Message "You are running a single check that is not yet converted to v5." -Level Warning
377+
# So that if all of the checks passed in are not yet converted so that we stop
378+
379+
# Compare the two arrays
380+
$comparisonResult = Compare-Object -ReferenceObject $check -DifferenceObject $notv5
381+
382+
# If all elements of $check are in $notv5, then $comparisonResult will be either $null or only contain differences where SideIndicator is '=>'
383+
384+
if (($comparisonResult | Where-Object SideIndicator -EQ '<=').Count -eq 0) {
385+
$Message = "The checks that you are running {0} are yet to be converted to v5 unfortunately. We cannot continue. Please use the legacy switch"
386+
Write-PSFMessage -Message $Message -Level Warning
380387
Return
381388
}
389+
382390
foreach ($c in $Check) {
383391
# So that if the only check passed in is not yet converted
384392
if ($c -in $notv5) {

0 commit comments

Comments
 (0)