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

Commit

Permalink
vscode formatting (#83)
Browse files Browse the repository at this point in the history
* use OTBS code formatting

PoshCode/PowerShellPracticeAndStyle#81 (comment)

* auto format & save on powershell
  • Loading branch information
jetersen committed Nov 25, 2019
1 parent 53f6b37 commit fbfc059
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 23 deletions.
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"ms-vscode.powershell",
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"powershell.codeFormatting.preset": "OTBS",
"[powershell]": {
"editor.formatOnSave": true,
"files.autoSave": "onFocusChange",
},
}
2 changes: 1 addition & 1 deletion Invoke-Publish.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Invoke-Psake -buildFile "$PSScriptRoot/Build.ps1" -taskList build,test,publish
Invoke-Psake -buildFile "$PSScriptRoot/Build.ps1" -taskList build, test, publish
exit ( [int]( -not $psake.build_success ) )
2 changes: 1 addition & 1 deletion Invoke-Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Invoke-Psake -buildFile "$PSScriptRoot/Build.ps1" -taskList build,test
Invoke-Psake -buildFile "$PSScriptRoot/Build.ps1" -taskList build, test
exit ( [int]( -not $psake.build_success ) )
3 changes: 1 addition & 2 deletions Source/Docker-CI.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Foreach ($import in @($Public + $Private)) {
Try {
Write-Debug "Importing ${import}"
. $import.fullname # Rewrite to bundle all in scriptblock so types do don't go out of scope.
}
Catch {
} Catch {
Write-Error -Message "Failed to import function $($import.fullname): $_"
}
}
Expand Down
3 changes: 1 addition & 2 deletions Source/Private/Invoke-Command.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ function Invoke-Command {
$result.Success = $?
$result.ExitCode = $lastexitcode
$result.Output = $outputs
}
finally {
} finally {
$script:ErrorActionPreference = $backupErrorActionPreference
}
return $result
Expand Down
5 changes: 1 addition & 4 deletions Source/Private/Remove-Prefix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ function Remove-Prefix {
If ($Value.StartsWith($Prefix)) {
$result = $Value.Substring($Prefix.Length)
return $result
}
else {
} else {
return $Value
}
}


2 changes: 1 addition & 1 deletion Source/Private/Test-DockerDigest.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

function Test-DockerDigest {
param (
[Parameter(Mandatory=$true)]
[Parameter(Mandatory = $true)]
[String] $Digest
)

Expand Down
2 changes: 1 addition & 1 deletion Test-Data/PesterTests/AtLevel0.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Describe 'At level 0' {
It 'is true' {
$true | Should -Be $true
}
}
}
2 changes: 1 addition & 1 deletion Test-Data/PesterTests/Level1/AtLevel1.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Describe 'At level 1' {
It 'is true' {
$true | Should -Be $true
}
}
}
2 changes: 0 additions & 2 deletions Test-Source/Find-Lint-Remarks.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,3 @@ Describe 'Parse context from git repository' {
}
}
}


3 changes: 1 addition & 2 deletions Test-Source/Format-AsAbsolutePath.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Describe 'Parse absolute path from input string' {
Context 'When an absolute path is provided' {
if ($IsWindows) {
$absolutePath = 'C:\Windows\System32'
}
elseif ($IsLinux) {
} elseif ($IsLinux) {
$absolutePath = '/usr/bin'
}

Expand Down
3 changes: 1 addition & 2 deletions Test-Source/Invoke-Command.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Describe 'Run external tools as commands' {
Context 'Run a simple external command' {
if ($IsWindows) {
$commandName = "find /?"
}
elseif ($IsLinux) {
} elseif ($IsLinux) {
$commandName = "grep --help"
}

Expand Down
6 changes: 2 additions & 4 deletions Test-Source/Invoke-DockerLint.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ Describe 'Execute linting on a given docker image' {
for ($i = 0; $i -lt $lintedDockerFile.Length; $i++) {
$lintedDockerFile[$i] | Should -Be $result[$i]
}
}
catch {
} catch {
}
}

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

}
Expand Down

0 comments on commit fbfc059

Please sign in to comment.