Skip to content

Commit 4fc419d

Browse files
committed
fix(#194): standardize catch block formatting across multiple scripts
- Adjusted catch blocks to maintain consistent formatting - Improved readability by aligning else statements
1 parent 3929021 commit 4fc419d

46 files changed

Lines changed: 70 additions & 140 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

scripts/build/Sync-AgenticCopilotScaffold.ps1

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ function Test-AgenticPathExcluded {
5656
if ( $normalizedRelativePath.StartsWith($normalizedExcludedPath, [System.StringComparison]::Ordinal)) {
5757
return $true
5858
}
59-
}
60-
elseif ($normalizedRelativePath -eq $normalizedExcludedPath) {
59+
} elseif ($normalizedRelativePath -eq $normalizedExcludedPath) {
6160
return $true
6261
}
6362
}
@@ -80,8 +79,7 @@ function Get-AgenticMirrorSourceFile {
8079

8180
if (Test-Path -LiteralPath $resolvedSourcePath -PathType Leaf) {
8281
Get-Item -LiteralPath $resolvedSourcePath
83-
}
84-
else {
82+
} else {
8583
Get-ChildItem -LiteralPath $resolvedSourcePath -File -Recurse -Force
8684
}
8785
}
@@ -206,8 +204,7 @@ function Invoke-AgenticCopilotScaffoldSync {
206204
MirroredFileCount = $sourceFileList.Count
207205
ScaffoldOwnedPathCount = @($manifest.ScaffoldOwnedPaths).Count
208206
}
209-
}
210-
finally {
207+
} finally {
211208
if (Test-Path -LiteralPath $stagingParent) {
212209
Remove-Item -LiteralPath $stagingParent -Recurse -Force
213210
}

scripts/build/ci/CodeSceneCoverageMap.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ function Get-CoberturaLineStat {
9191
$coveredLineCount = @($Bucket.Values | Where-Object {$_ -gt 0}).Count
9292
$lineRate = if ($validLineCount -eq 0) {
9393
0
94-
}
95-
else {
94+
} else {
9695
$coveredLineCount / $validLineCount
9796
}
9897

scripts/build/ci/CodeSceneCoverageXml.ps1

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ function Get-CoberturaPackageElement {
7474

7575
$packageLineRate = if ($packageValidLineCount -eq 0) {
7676
0
77-
}
78-
else {
77+
} else {
7978
$packageCoveredLineCount / $packageValidLineCount
8079
}
8180

@@ -97,8 +96,7 @@ function Get-CoberturaCoverageAttributeMap {
9796

9897
$lineRate = if ($ValidLineCount -eq 0) {
9998
0
100-
}
101-
else {
99+
} else {
102100
$CoveredLineCount / $ValidLineCount
103101
}
104102

@@ -176,8 +174,7 @@ function Convert-CoberturaCoverageToSourcePath {
176174
$xmlWriter = [System.Xml.XmlWriter]::Create($CoveragePath, $xmlWriterSettings)
177175
try {
178176
$newCoverageXml.Save($xmlWriter)
179-
}
180-
finally {
177+
} finally {
181178
$xmlWriter.Dispose()
182179
}
183180
}

scripts/build/ci/Invoke-NovaModuleToolsCI.ps1

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,13 @@ $novaModuleToolsTestFailed = $false
7676
try {
7777
if (@($ExcludeTag).Count -gt 0) {
7878
Test-NovaBuild -ExcludeTagFilter $ExcludeTag
79-
}
80-
else {
79+
} else {
8180
Test-NovaBuild
8281
}
83-
}
84-
catch {
82+
} catch {
8583
$novaModuleToolsTestFailed = $true
8684
Write-Warning "Test-NovaBuild failed: $( $_.Exception.Message )"
87-
}
88-
finally {
85+
} finally {
8986
Copy-NovaModuleToolsTestResultIfPresent -ProjectRoot $projectInfo.ProjectRoot -ArtifactsDirectory $OutputDirectory
9087
}
9188

src/private/build/AssertNovaPublicFunctionFileLayout.ps1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ function Get-NovaInvalidPublicFunctionFileList {
2222
[pscustomobject]@{
2323
FilePath = if ($ProjectInfo.PSObject.Properties.Name -contains 'ProjectRoot') {
2424
[System.IO.Path]::GetRelativePath($ProjectInfo.ProjectRoot, $publicFunctionFile.FullName)
25-
}
26-
else {
25+
} else {
2726
$publicFunctionFile.FullName
2827
}
2928
FunctionNameList = $functionNameList
@@ -48,8 +47,7 @@ function Format-NovaPublicFunctionFileValidationMessage {
4847
foreach ($invalidFile in $InvalidFileList) {
4948
$functionText = if (@($invalidFile.FunctionNameList).Count -eq 0) {
5049
'<none>'
51-
}
52-
else {
50+
} else {
5351
@($invalidFile.FunctionNameList) -join ', '
5452
}
5553

src/private/build/Format-ProjectJsonValue.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ function Format-ProjectJsonValue {
88

99
try {
1010
return ($Value | ConvertTo-Json -Compress -Depth 10)
11-
}
12-
catch {
11+
} catch {
1312
return [string]$Value
1413
}
1514
}

src/private/build/GetOrderedScriptFileForDirectory.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ function Get-OrderedScriptFileForDirectory {
1212

1313
$items = if ($Recurse) {
1414
Get-ChildItem -Path $Directory -Filter '*.ps1' -File -Recurse -ErrorAction SilentlyContinue
15-
}
16-
else {
15+
} else {
1716
Get-ChildItem -Path $Directory -Filter '*.ps1' -File -ErrorAction SilentlyContinue
1817
}
1918

src/private/build/InvokeNovaBuildWorkflow.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ function Invoke-NovaBuildUpdateNotificationSafely {
4141

4242
try {
4343
Invoke-NovaBuildUpdateNotification
44-
}
45-
catch {
44+
} catch {
4645
$null = $_
4746
}
4847
}

src/private/build/TestProjectSchema.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ function Test-ProjectSchema {
2020
Test-Json -Path 'project.json' -Schema (Get-Content $SchemaPath.Pester -Raw)
2121
}
2222
}
23-
}
24-
catch {
23+
} catch {
2524
Stop-NovaOperation -Message "Invalid project.json for the $Schema schema: $( $_.Exception.Message )" -ErrorId 'Nova.Configuration.ProjectSchemaValidationFailed' -Category InvalidData -TargetObject 'project.json'
2625
}
2726

src/private/build/manifest/GetFunctionNameFromFile.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ function Get-FunctionNameFromFile {
55
$ast = [System.Management.Automation.Language.Parser]::ParseInput($moduleContent, [ref]$null, [ref]$null)
66
$functionName = $ast.FindAll({$args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst]}, $false) | ForEach-Object {$_.Name}
77
return $functionName
8-
}
9-
catch {
8+
} catch {
109
return ''
1110
}
1211
}

0 commit comments

Comments
 (0)