diff --git a/CHANGELOG.md b/CHANGELOG.md index d68ba8b..035657f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,3 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Public commands: - `Convert-PesterSyntax` - GitHub templates. + +### Fixed + +- Fixed code formatting according to style guideline. diff --git a/source/Private/Convert-ShouldBe.ps1 b/source/Private/Convert-ShouldBe.ps1 index fcfd8ce..7ce2cbd 100644 --- a/source/Private/Convert-ShouldBe.ps1 +++ b/source/Private/Convert-ShouldBe.ps1 @@ -66,7 +66,7 @@ function Convert-ShouldBe ) $assertBoundParameterParameters = @{ - BoundParameterList = $PSBoundParameters + BoundParameterList = $PSBoundParameters MutuallyExclusiveList1 = @('UseNamedParameters') MutuallyExclusiveList2 = @('UsePositionalParameters') } @@ -96,9 +96,9 @@ function Convert-ShouldBe } $getPesterCommandParameterParameters = @{ - CommandAst = $CommandAst - CommandName = 'Should' - IgnoreParameter = @( + CommandAst = $CommandAst + CommandName = 'Should' + IgnoreParameter = @( 'Be' 'EQ' 'Not' diff --git a/source/Private/Convert-ShouldBeExactly.ps1 b/source/Private/Convert-ShouldBeExactly.ps1 index 1db2e01..d7871c8 100644 --- a/source/Private/Convert-ShouldBeExactly.ps1 +++ b/source/Private/Convert-ShouldBeExactly.ps1 @@ -66,7 +66,7 @@ function Convert-ShouldBeExactly ) $assertBoundParameterParameters = @{ - BoundParameterList = $PSBoundParameters + BoundParameterList = $PSBoundParameters MutuallyExclusiveList1 = @('UseNamedParameters') MutuallyExclusiveList2 = @('UsePositionalParameters') } @@ -99,9 +99,9 @@ function Convert-ShouldBeExactly $newExtentText += ' -CaseSensitive' $getPesterCommandParameterParameters = @{ - CommandAst = $CommandAst - CommandName = 'Should' - IgnoreParameter = @( + CommandAst = $CommandAst + CommandName = 'Should' + IgnoreParameter = @( 'CEQ' 'BeExactly' 'Not' diff --git a/source/Private/Convert-ShouldBeFalse.ps1 b/source/Private/Convert-ShouldBeFalse.ps1 index 74c956c..8bc0d5c 100644 --- a/source/Private/Convert-ShouldBeFalse.ps1 +++ b/source/Private/Convert-ShouldBeFalse.ps1 @@ -67,7 +67,7 @@ function Convert-ShouldBeFalse ) $assertBoundParameterParameters = @{ - BoundParameterList = $PSBoundParameters + BoundParameterList = $PSBoundParameters MutuallyExclusiveList1 = @('UseNamedParameters') MutuallyExclusiveList2 = @('UsePositionalParameters') } @@ -97,9 +97,9 @@ function Convert-ShouldBeFalse } $getPesterCommandParameterParameters = @{ - CommandAst = $CommandAst - CommandName = 'Should' - IgnoreParameter = 'BeFalse', 'Not' + CommandAst = $CommandAst + CommandName = 'Should' + IgnoreParameter = 'BeFalse', 'Not' PositionalParameter = 'Because', 'ActualValue' } diff --git a/source/Private/Convert-ShouldBeNullOrEmpty.ps1 b/source/Private/Convert-ShouldBeNullOrEmpty.ps1 index c6f68c9..554eb2e 100644 --- a/source/Private/Convert-ShouldBeNullOrEmpty.ps1 +++ b/source/Private/Convert-ShouldBeNullOrEmpty.ps1 @@ -75,7 +75,7 @@ function Convert-ShouldBeNullOrEmpty ) $assertBoundParameterParameters = @{ - BoundParameterList = $PSBoundParameters + BoundParameterList = $PSBoundParameters MutuallyExclusiveList1 = @('UseNamedParameters') MutuallyExclusiveList2 = @('UsePositionalParameters') } @@ -105,9 +105,9 @@ function Convert-ShouldBeNullOrEmpty } $getPesterCommandParameterParameters = @{ - CommandAst = $CommandAst - CommandName = 'Should' - IgnoreParameter = 'BeNullOrEmpty', 'Not' + CommandAst = $CommandAst + CommandName = 'Should' + IgnoreParameter = 'BeNullOrEmpty', 'Not' PositionalParameter = 'Because', 'ActualValue' } diff --git a/source/Private/Convert-ShouldBeOfType.ps1 b/source/Private/Convert-ShouldBeOfType.ps1 index 5ec51c7..7d3b070 100644 --- a/source/Private/Convert-ShouldBeOfType.ps1 +++ b/source/Private/Convert-ShouldBeOfType.ps1 @@ -79,7 +79,7 @@ function Convert-ShouldBeOfType ) $assertBoundParameterParameters = @{ - BoundParameterList = $PSBoundParameters + BoundParameterList = $PSBoundParameters MutuallyExclusiveList1 = @('UseNamedParameters') MutuallyExclusiveList2 = @('UsePositionalParameters') } @@ -109,9 +109,9 @@ function Convert-ShouldBeOfType } $getPesterCommandParameterParameters = @{ - CommandAst = $CommandAst - CommandName = 'Should' - IgnoreParameter = @( + CommandAst = $CommandAst + CommandName = 'Should' + IgnoreParameter = @( 'BeOfType' 'HaveType' 'Not' @@ -120,7 +120,7 @@ function Convert-ShouldBeOfType 'ExpectedValue' 'Because' ) - NamedParameter = @( + NamedParameter = @( 'ActualValue' ) } diff --git a/source/Private/Convert-ShouldBeTrue.ps1 b/source/Private/Convert-ShouldBeTrue.ps1 index 3ecc522..0857342 100644 --- a/source/Private/Convert-ShouldBeTrue.ps1 +++ b/source/Private/Convert-ShouldBeTrue.ps1 @@ -70,7 +70,7 @@ function Convert-ShouldBeTrue ) $assertBoundParameterParameters = @{ - BoundParameterList = $PSBoundParameters + BoundParameterList = $PSBoundParameters MutuallyExclusiveList1 = @('UseNamedParameters') MutuallyExclusiveList2 = @('UsePositionalParameters') } @@ -100,9 +100,9 @@ function Convert-ShouldBeTrue } $getPesterCommandParameterParameters = @{ - CommandAst = $CommandAst - CommandName = 'Should' - IgnoreParameter = 'BeTrue', 'Not' + CommandAst = $CommandAst + CommandName = 'Should' + IgnoreParameter = 'BeTrue', 'Not' PositionalParameter = 'Because', 'ActualValue' } diff --git a/source/Private/Convert-ShouldContain.ps1 b/source/Private/Convert-ShouldContain.ps1 index 883d26c..35fc5a9 100644 --- a/source/Private/Convert-ShouldContain.ps1 +++ b/source/Private/Convert-ShouldContain.ps1 @@ -65,7 +65,7 @@ function Convert-ShouldContain ) $assertBoundParameterParameters = @{ - BoundParameterList = $PSBoundParameters + BoundParameterList = $PSBoundParameters MutuallyExclusiveList1 = @('UseNamedParameters') MutuallyExclusiveList2 = @('UsePositionalParameters') } @@ -95,9 +95,9 @@ function Convert-ShouldContain } $getPesterCommandParameterParameters = @{ - CommandAst = $CommandAst - CommandName = 'Should' - IgnoreParameter = @( + CommandAst = $CommandAst + CommandName = 'Should' + IgnoreParameter = @( 'Contain' 'Not' ) @@ -105,7 +105,7 @@ function Convert-ShouldContain 'ExpectedValue' 'Because' ) - NamedParameter = @( + NamedParameter = @( 'ActualValue' ) } diff --git a/source/Private/Convert-ShouldMatch.ps1 b/source/Private/Convert-ShouldMatch.ps1 index 783c764..f7f8045 100644 --- a/source/Private/Convert-ShouldMatch.ps1 +++ b/source/Private/Convert-ShouldMatch.ps1 @@ -67,7 +67,7 @@ function Convert-ShouldMatch ) $assertBoundParameterParameters = @{ - BoundParameterList = $PSBoundParameters + BoundParameterList = $PSBoundParameters MutuallyExclusiveList1 = @('UseNamedParameters') MutuallyExclusiveList2 = @('UsePositionalParameters') } @@ -97,9 +97,9 @@ function Convert-ShouldMatch } $getPesterCommandParameterParameters = @{ - CommandAst = $CommandAst - CommandName = 'Should' - IgnoreParameter = @( + CommandAst = $CommandAst + CommandName = 'Should' + IgnoreParameter = @( 'Match' 'Not' ) diff --git a/source/Private/Convert-ShouldMatchExactly.ps1 b/source/Private/Convert-ShouldMatchExactly.ps1 index f5043f6..1e87390 100644 --- a/source/Private/Convert-ShouldMatchExactly.ps1 +++ b/source/Private/Convert-ShouldMatchExactly.ps1 @@ -66,7 +66,7 @@ function Convert-ShouldMatchExactly ) $assertBoundParameterParameters = @{ - BoundParameterList = $PSBoundParameters + BoundParameterList = $PSBoundParameters MutuallyExclusiveList1 = @('UseNamedParameters') MutuallyExclusiveList2 = @('UsePositionalParameters') } @@ -99,9 +99,9 @@ function Convert-ShouldMatchExactly $newExtentText += ' -CaseSensitive' $getPesterCommandParameterParameters = @{ - CommandAst = $CommandAst - CommandName = 'Should' - IgnoreParameter = @( + CommandAst = $CommandAst + CommandName = 'Should' + IgnoreParameter = @( 'CMATCH' 'MatchExactly' 'Not' diff --git a/source/Private/Convert-ShouldNotThrow.ps1 b/source/Private/Convert-ShouldNotThrow.ps1 index beb7106..57191d2 100644 --- a/source/Private/Convert-ShouldNotThrow.ps1 +++ b/source/Private/Convert-ShouldNotThrow.ps1 @@ -72,7 +72,7 @@ function Convert-ShouldNotThrow ) $assertBoundParameterParameters = @{ - BoundParameterList = $PSBoundParameters + BoundParameterList = $PSBoundParameters MutuallyExclusiveList1 = @('UseNamedParameters') MutuallyExclusiveList2 = @('UsePositionalParameters') } diff --git a/source/Private/Convert-ShouldThrow.ps1 b/source/Private/Convert-ShouldThrow.ps1 index ec529cf..ec80cf0 100644 --- a/source/Private/Convert-ShouldThrow.ps1 +++ b/source/Private/Convert-ShouldThrow.ps1 @@ -77,7 +77,7 @@ function Convert-ShouldThrow ) $assertBoundParameterParameters = @{ - BoundParameterList = $PSBoundParameters + BoundParameterList = $PSBoundParameters MutuallyExclusiveList1 = @('UseNamedParameters') MutuallyExclusiveList2 = @('UsePositionalParameters') } @@ -116,9 +116,9 @@ function Convert-ShouldThrow } $getPesterCommandParameterParameters = @{ - CommandAst = $CommandAst - CommandName = 'Should' - IgnoreParameter = @( + CommandAst = $CommandAst + CommandName = 'Should' + IgnoreParameter = @( 'Throw' 'Not' 'PassThru' @@ -129,7 +129,7 @@ function Convert-ShouldThrow 'ExceptionType' 'Because' ) - NamedParameter = @( + NamedParameter = @( 'ActualValue' ) } diff --git a/source/Private/Get-CommandAst.ps1 b/source/Private/Get-CommandAst.ps1 index 20043a6..372c7a5 100644 --- a/source/Private/Get-CommandAst.ps1 +++ b/source/Private/Get-CommandAst.ps1 @@ -48,14 +48,14 @@ function Get-CommandAst Write-Verbose -Message "Retrieving the AST of the command: $CommandName" $commandAsts = $Ast.FindAll({ - param - ( - [Parameter()] - $node - ) - - return $node -is [System.Management.Automation.Language.CommandAst] -and $node.GetCommandName() -eq $CommandName - }, $true) + param + ( + [Parameter()] + $node + ) + + return $node -is [System.Management.Automation.Language.CommandAst] -and $node.GetCommandName() -eq $CommandName + }, $true) return $commandAsts } diff --git a/source/Private/Get-PesterCommandParameter.ps1 b/source/Private/Get-PesterCommandParameter.ps1 index 9f8470a..3b37494 100644 --- a/source/Private/Get-PesterCommandParameter.ps1 +++ b/source/Private/Get-PesterCommandParameter.ps1 @@ -68,12 +68,12 @@ function Get-PesterCommandParameter # Filter out the command name from the command elements. $commandElement = $CommandAst.CommandElements | - Where-Object -FilterScript { - -not ( - $_ -is [System.Management.Automation.Language.StringConstantExpressionAst] ` + Where-Object -FilterScript { + -not ( + $_ -is [System.Management.Automation.Language.StringConstantExpressionAst] ` -and $_.Extent.Text -eq $CommandName - ) - } + ) + } Write-Debug -Message "Ignoring the parameters: $($IgnoreParameter -join ', ')" @@ -86,7 +86,7 @@ function Get-PesterCommandParameter Where-Object -FilterScript { -not ( $_ -is [System.Management.Automation.Language.CommandParameterAst] ` - -and $_.ParameterName -in $IgnoreParameter + -and $_.ParameterName -in $IgnoreParameter ) } @@ -103,7 +103,7 @@ function Get-PesterCommandParameter - ExpectedValue - Because #> - $parameterElements = $commandElement.Where({$_ -is [System.Management.Automation.Language.CommandParameterAst] -and ($_.ParameterName -in $PositionalParameter -or $_.ParameterName -in $NamedParameter)}) + $parameterElements = $commandElement.Where({ $_ -is [System.Management.Automation.Language.CommandParameterAst] -and ($_.ParameterName -in $PositionalParameter -or $_.ParameterName -in $NamedParameter) }) $filterCommandElements = @() @@ -117,7 +117,7 @@ function Get-PesterCommandParameter $parameterName = $commandElement[$parameterIndex].ParameterName $positionalParameterHashtable.$parameterName = @{ - Position = 0 + Position = 0 Positional = $false ExtentText = $commandElement[$parameterIndex + 1].Extent.Text } @@ -147,7 +147,7 @@ function Get-PesterCommandParameter { # Only add positional parameter if there actually a value for it. $positionalParameterHashtable.$parameter = @{ - Position = $positionalCounter + Position = $positionalCounter Positional = $true ExtentText = $commandElement[$elementCounter].Extent.Text #? $commandElement.Extent.Text : $null } diff --git a/source/Private/Get-ShouldCommandOperatorName.ps1 b/source/Private/Get-ShouldCommandOperatorName.ps1 index b5a93b6..675ba7a 100644 --- a/source/Private/Get-ShouldCommandOperatorName.ps1 +++ b/source/Private/Get-ShouldCommandOperatorName.ps1 @@ -68,25 +68,25 @@ function Get-ShouldCommandOperatorName # Operator aliases. Output from Pester's command Get-ShouldOperator. $possibleShouldOperatorAlias = @{ - 'EQ' = 'Be' - 'CEQ' = 'BeExactly' - 'GT' = 'BeGreaterThan' - 'LE' = 'BeLessOrEqual' - 'LT' = 'BeLessThan' - 'GE' = 'BeGreaterOrEqual' + 'EQ' = 'Be' + 'CEQ' = 'BeExactly' + 'GT' = 'BeGreaterThan' + 'LE' = 'BeLessOrEqual' + 'LT' = 'BeLessThan' + 'GE' = 'BeGreaterOrEqual' 'HaveType' = 'BeOfType' - 'CMATCH' = 'MatchExactly' + 'CMATCH' = 'MatchExactly' } $shouldOperatorAsts = $CommandAst.Find({ - param - ( - [Parameter()] - $node - ) + param + ( + [Parameter()] + $node + ) - return $node -is [System.Management.Automation.Language.CommandParameterAst] -and ($node.ParameterName -in $possibleShouldOperator -or $node.ParameterName -in $possibleShouldOperatorAlias.Keys) - }, $true) + return $node -is [System.Management.Automation.Language.CommandParameterAst] -and ($node.ParameterName -in $possibleShouldOperator -or $node.ParameterName -in $possibleShouldOperatorAlias.Keys) + }, $true) if ($shouldOperatorAsts.ParameterName -in $possibleShouldOperatorAlias.Keys) { diff --git a/source/Private/Test-PesterCommandNegated.ps1 b/source/Private/Test-PesterCommandNegated.ps1 index 1148de5..c27893a 100644 --- a/source/Private/Test-PesterCommandNegated.ps1 +++ b/source/Private/Test-PesterCommandNegated.ps1 @@ -49,8 +49,8 @@ function Test-PesterCommandNegated $negateCommandParameterAst = $CommandAst.CommandElements | Where-Object -FilterScript { $_ -is [System.Management.Automation.Language.CommandParameterAst] ` - -and $_.ParameterName -eq 'Not' ` - -and $_.Argument.Extent.Text -ne '$false' + -and $_.ParameterName -eq 'Not' ` + -and $_.Argument.Extent.Text -ne '$false' } $negated = $false diff --git a/source/Public/Convert-PesterSyntax.ps1 b/source/Public/Convert-PesterSyntax.ps1 index d25605d..4bb61c1 100644 --- a/source/Public/Convert-PesterSyntax.ps1 +++ b/source/Public/Convert-PesterSyntax.ps1 @@ -82,7 +82,7 @@ function Convert-PesterSyntax } $assertBoundParameterParameters = @{ - BoundParameterList = $PSBoundParameters + BoundParameterList = $PSBoundParameters MutuallyExclusiveList1 = @('UseNamedParameters') MutuallyExclusiveList2 = @('UsePositionalParameters') }