Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit fbfc059

Browse files
authored
vscode formatting (#83)
* use OTBS code formatting PoshCode/PowerShellPracticeAndStyle#81 (comment) * auto format & save on powershell
1 parent 53f6b37 commit fbfc059

14 files changed

+24
-23
lines changed

.vscode/extensions.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"ms-vscode.powershell",
4+
]
5+
}

.vscode/settings.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"powershell.codeFormatting.preset": "OTBS",
3+
"[powershell]": {
4+
"editor.formatOnSave": true,
5+
"files.autoSave": "onFocusChange",
6+
},
7+
}

Invoke-Publish.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Invoke-Psake -buildFile "$PSScriptRoot/Build.ps1" -taskList build,test,publish
1+
Invoke-Psake -buildFile "$PSScriptRoot/Build.ps1" -taskList build, test, publish
22
exit ( [int]( -not $psake.build_success ) )

Invoke-Tests.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Invoke-Psake -buildFile "$PSScriptRoot/Build.ps1" -taskList build,test
1+
Invoke-Psake -buildFile "$PSScriptRoot/Build.ps1" -taskList build, test
22
exit ( [int]( -not $psake.build_success ) )

Source/Docker-CI.psm1

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ Foreach ($import in @($Public + $Private)) {
77
Try {
88
Write-Debug "Importing ${import}"
99
. $import.fullname # Rewrite to bundle all in scriptblock so types do don't go out of scope.
10-
}
11-
Catch {
10+
} Catch {
1211
Write-Error -Message "Failed to import function $($import.fullname): $_"
1312
}
1413
}

Source/Private/Invoke-Command.ps1

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ function Invoke-Command {
1515
$result.Success = $?
1616
$result.ExitCode = $lastexitcode
1717
$result.Output = $outputs
18-
}
19-
finally {
18+
} finally {
2019
$script:ErrorActionPreference = $backupErrorActionPreference
2120
}
2221
return $result

Source/Private/Remove-Prefix.ps1

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ function Remove-Prefix {
1313
If ($Value.StartsWith($Prefix)) {
1414
$result = $Value.Substring($Prefix.Length)
1515
return $result
16-
}
17-
else {
16+
} else {
1817
return $Value
1918
}
2019
}
21-
22-

Source/Private/Test-DockerDigest.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
function Test-DockerDigest {
33
param (
4-
[Parameter(Mandatory=$true)]
4+
[Parameter(Mandatory = $true)]
55
[String] $Digest
66
)
77

Test-Data/PesterTests/AtLevel0.Tests.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Describe 'At level 0' {
33
It 'is true' {
44
$true | Should -Be $true
55
}
6-
}
6+
}

Test-Data/PesterTests/Level1/AtLevel1.Tests.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Describe 'At level 1' {
33
It 'is true' {
44
$true | Should -Be $true
55
}
6-
}
6+
}

Test-Source/Find-Lint-Remarks.Tests.ps1

-2
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,3 @@ Describe 'Parse context from git repository' {
3535
}
3636
}
3737
}
38-
39-

Test-Source/Format-AsAbsolutePath.Tests.ps1

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ Describe 'Parse absolute path from input string' {
77
Context 'When an absolute path is provided' {
88
if ($IsWindows) {
99
$absolutePath = 'C:\Windows\System32'
10-
}
11-
elseif ($IsLinux) {
10+
} elseif ($IsLinux) {
1211
$absolutePath = '/usr/bin'
1312
}
1413

Test-Source/Invoke-Command.Tests.ps1

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ Describe 'Run external tools as commands' {
88
Context 'Run a simple external command' {
99
if ($IsWindows) {
1010
$commandName = "find /?"
11-
}
12-
elseif ($IsLinux) {
11+
} elseif ($IsLinux) {
1312
$commandName = "grep --help"
1413
}
1514

Test-Source/Invoke-DockerLint.Tests.ps1

+2-4
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ Describe 'Execute linting on a given docker image' {
3838
for ($i = 0; $i -lt $lintedDockerFile.Length; $i++) {
3939
$lintedDockerFile[$i] | Should -Be $result[$i]
4040
}
41-
}
42-
catch {
41+
} catch {
4342
}
4443
}
4544

@@ -53,8 +52,7 @@ Describe 'Execute linting on a given docker image' {
5352
It 'throws correct exception message if docker image does not exist' {
5453
try {
5554
Invoke-DockerLint -DockerFile "not.here"
56-
}
57-
catch {
55+
} catch {
5856
$exception = $_.Exception
5957

6058
}

0 commit comments

Comments
 (0)