Skip to content
This repository was archived by the owner on Feb 24, 2021. It is now read-only.

Commit d7d599e

Browse files
committed
Changes as per PR comments
1 parent a4a3b4e commit d7d599e

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

DscResource.AnalyzerRules/DscResource.AnalyzerRules.Helper.psm1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
.OUTPUTS
1313
[System.Boolean]
1414
15-
.NOTES
15+
.NOTES
1616
I initially just walked up the AST tree till I hit
1717
a TypeDefinitionAst that was a class
1818
@@ -98,7 +98,7 @@ function Test-IsInClass
9898
.OUTPUTS
9999
[System.String[]]
100100
101-
.NOTES
101+
.NOTES
102102
None
103103
#>
104104
function Get-StatementBlockAsRows
@@ -136,7 +136,7 @@ function Get-StatementBlockAsRows
136136
.OUTPUTS
137137
[System.Boolean]
138138
139-
.NOTES
139+
.NOTES
140140
None
141141
#>
142142
function Test-StatementOpeningBraceOnSameLine
@@ -178,7 +178,7 @@ function Test-StatementOpeningBraceOnSameLine
178178
.OUTPUTS
179179
[System.Boolean]
180180
181-
.NOTES
181+
.NOTES
182182
None
183183
#>
184184
function Test-StatementOpeningBraceIsNotFollowedByNewLine
@@ -220,7 +220,7 @@ function Test-StatementOpeningBraceIsNotFollowedByNewLine
220220
.OUTPUTS
221221
[System.Boolean]
222222
223-
.NOTES
223+
.NOTES
224224
None
225225
#>
226226
function Test-StatementOpeningBraceIsFollowedByMoreThanOneNewLine
@@ -254,17 +254,17 @@ function Test-StatementOpeningBraceIsFollowedByMoreThanOneNewLine
254254
Tests if the statement at the beginning of the string contains any
255255
upper case letters.
256256
257-
.EXAMPLE
258-
Test-StatementContainsUpperCase -StatementBlock $ScriptBlockAst.Extent
259-
260257
.PARAMETER StatementBlock
261258
The StatementBlock that contains the statement to check contains any
262259
upper case letters.
263260
261+
.EXAMPLE
262+
Test-StatementContainsUpperCase -StatementBlock $ScriptBlockAst.Extent
263+
264264
.OUTPUTS
265265
[System.Boolean]
266266
267-
.NOTES
267+
.NOTES
268268
None
269269
#>
270270
function Test-StatementContainsUpperCase

DscResource.AnalyzerRules/DscResource.AnalyzerRules.psm1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ function Measure-IfStatement
310310

311311
if (Test-StatementContainsUpperCase @testParameters)
312312
{
313-
$script:diagnosticRecord['Message'] = ($localizedData.StatementsContainsUpperCaseLetter -f 'if')
313+
$script:diagnosticRecord['Message'] = $localizedData.StatementsContainsUpperCaseLetter -f 'if'
314314
$script:diagnosticRecord -as $diagnosticRecordType
315315
} # if
316316
}
@@ -382,7 +382,7 @@ function Measure-ForEachStatement
382382

383383
if (Test-StatementContainsUpperCase @testParameters)
384384
{
385-
$script:diagnosticRecord['Message'] = ($localizedData.StatementsContainsUpperCaseLetter -f 'foreach')
385+
$script:diagnosticRecord['Message'] = $localizedData.StatementsContainsUpperCaseLetter -f 'foreach'
386386
$script:diagnosticRecord -as $diagnosticRecordType
387387
} # if
388388
}
@@ -454,7 +454,7 @@ function Measure-DoUntilStatement
454454

455455
if (Test-StatementContainsUpperCase @testParameters)
456456
{
457-
$script:diagnosticRecord['Message'] = ($localizedData.StatementsContainsUpperCaseLetter -f 'do')
457+
$script:diagnosticRecord['Message'] = $localizedData.StatementsContainsUpperCaseLetter -f 'do'
458458
$script:diagnosticRecord -as $diagnosticRecordType
459459
} # if
460460
}
@@ -526,7 +526,7 @@ function Measure-DoWhileStatement
526526

527527
if (Test-StatementContainsUpperCase @testParameters)
528528
{
529-
$script:diagnosticRecord['Message'] = ($localizedData.StatementsContainsUpperCaseLetter -f 'do')
529+
$script:diagnosticRecord['Message'] = $localizedData.StatementsContainsUpperCaseLetter -f 'do'
530530
$script:diagnosticRecord -as $diagnosticRecordType
531531
} # if
532532
}
@@ -598,7 +598,7 @@ function Measure-WhileStatement
598598

599599
if (Test-StatementContainsUpperCase @testParameters)
600600
{
601-
$script:diagnosticRecord['Message'] = ($localizedData.StatementsContainsUpperCaseLetter -f 'while')
601+
$script:diagnosticRecord['Message'] = $localizedData.StatementsContainsUpperCaseLetter -f 'while'
602602
$script:diagnosticRecord -as $diagnosticRecordType
603603
} # if
604604
}
@@ -670,7 +670,7 @@ function Measure-ForStatement
670670

671671
if (Test-StatementContainsUpperCase @testParameters)
672672
{
673-
$script:diagnosticRecord['Message'] = ($localizedData.StatementsContainsUpperCaseLetter -f 'for')
673+
$script:diagnosticRecord['Message'] = $localizedData.StatementsContainsUpperCaseLetter -f 'for'
674674
$script:diagnosticRecord -as $diagnosticRecordType
675675
} # if
676676
}
@@ -746,7 +746,7 @@ function Measure-SwitchStatement
746746

747747
if (Test-StatementContainsUpperCase @testParameters)
748748
{
749-
$script:diagnosticRecord['Message'] = ($localizedData.StatementsContainsUpperCaseLetter -f 'switch')
749+
$script:diagnosticRecord['Message'] = $localizedData.StatementsContainsUpperCaseLetter -f 'switch'
750750
$script:diagnosticRecord -as $diagnosticRecordType
751751
} # if
752752
}
@@ -818,7 +818,7 @@ function Measure-TryStatement
818818

819819
if (Test-StatementContainsUpperCase @testParameters)
820820
{
821-
$script:diagnosticRecord['Message'] = ($localizedData.StatementsContainsUpperCaseLetter -f 'try')
821+
$script:diagnosticRecord['Message'] = $localizedData.StatementsContainsUpperCaseLetter -f 'try'
822822
$script:diagnosticRecord -as $diagnosticRecordType
823823
} # if
824824
}
@@ -890,7 +890,7 @@ function Measure-CatchClause
890890

891891
if (Test-StatementContainsUpperCase @testParameters)
892892
{
893-
$script:diagnosticRecord['Message'] = ($localizedData.StatementsContainsUpperCaseLetter -f 'catch')
893+
$script:diagnosticRecord['Message'] = $localizedData.StatementsContainsUpperCaseLetter -f 'catch'
894894
$script:diagnosticRecord -as $diagnosticRecordType
895895
} # if
896896
}
@@ -963,7 +963,7 @@ function Measure-TypeDefinition
963963

964964
if (Test-StatementContainsUpperCase @testParameters)
965965
{
966-
$script:diagnosticRecord['Message'] = ($localizedData.StatementsContainsUpperCaseLetter -f 'enum')
966+
$script:diagnosticRecord['Message'] = $localizedData.StatementsContainsUpperCaseLetter -f 'enum'
967967
$script:diagnosticRecord -as $diagnosticRecordType
968968
} # if
969969
} # if
@@ -989,7 +989,7 @@ function Measure-TypeDefinition
989989

990990
if (Test-StatementContainsUpperCase @testParameters)
991991
{
992-
$script:diagnosticRecord['Message'] = ($localizedData.StatementsContainsUpperCaseLetter -f 'class')
992+
$script:diagnosticRecord['Message'] = $localizedData.StatementsContainsUpperCaseLetter -f 'class'
993993
$script:diagnosticRecord -as $diagnosticRecordType
994994
} # if
995995
} # if

DscResource.AnalyzerRules/en-US/DscResource.AnalyzerRules.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ParameterBlockNonMandatoryParameterMandatoryAttributeWrongFormat = Non-mandatory
88
FunctionOpeningBraceNotOnSameLine = Functions should not have the open brace on the same line as the function name. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#one-newline-before-braces
99
FunctionOpeningBraceShouldBeFollowedByNewLine = Opening brace on function should be followed by a new line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#one-newline-after-opening-brace
1010
FunctionOpeningBraceShouldBeFollowedByOnlyOneNewLine = Opening brace on functions should only be followed by one new line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#one-newline-after-opening-brace
11-
StatementsContainsUpperCaseLetter = {0}-Statement should be all lower case letters See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-keywords
11+
StatementsContainsUpperCaseLetter = '{0}' statements should not contain upper case letters See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-keywords
1212
IfStatementOpeningBraceNotOnSameLine = If-statements should not have the open brace on the same line as the statement. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#one-newline-before-braces
1313
IfStatementOpeningBraceShouldBeFollowedByNewLine = Opening brace on if-statements should be followed by a new line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#one-newline-after-opening-brace
1414
IfStatementOpeningBraceShouldBeFollowedByOnlyOneNewLine = Opening brace on if-statements should only be followed by one new line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#one-newline-after-opening-brace

Tests/Unit/DscResource.AnalyzerRules.Tests.ps1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ Describe 'Measure-IfStatement' {
12051205
}
12061206

12071207
Context 'When if-statement contains upper case letters' {
1208-
It 'Should not write an error record' {
1208+
It 'Should write the correct error record' {
12091209
$invokeScriptAnalyzerParameters['ScriptDefinition'] = '
12101210
function Get-Something
12111211
{
@@ -3018,7 +3018,7 @@ Describe 'Measure-TypeDefinition' {
30183018
$definition = '
30193019
class Test {
30203020
[int] $Good
3021-
[Void] Bad()
3021+
[void] Bad()
30223022
{
30233023
}
30243024
}
@@ -3037,7 +3037,7 @@ Describe 'Measure-TypeDefinition' {
30373037
$definition = '
30383038
class Test
30393039
{ [int] $Good
3040-
[Void] Bad()
3040+
[void] Bad()
30413041
{
30423042
}
30433043
}
@@ -3058,7 +3058,7 @@ Describe 'Measure-TypeDefinition' {
30583058
{
30593059
30603060
[int] $Good
3061-
[Void] Bad()
3061+
[void] Bad()
30623062
{
30633063
}
30643064
}
@@ -3078,7 +3078,7 @@ Describe 'Measure-TypeDefinition' {
30783078
Class Test
30793079
{
30803080
[int] $Good
3081-
[Void] Bad()
3081+
[void] Bad()
30823082
{
30833083
}
30843084
}
@@ -3176,7 +3176,7 @@ Describe 'Measure-TypeDefinition' {
31763176
$invokeScriptAnalyzerParameters['ScriptDefinition'] = '
31773177
class Test {
31783178
[int] $Good
3179-
[Void] Bad()
3179+
[void] Bad()
31803180
{
31813181
}
31823182
}
@@ -3194,7 +3194,7 @@ Describe 'Measure-TypeDefinition' {
31943194
$invokeScriptAnalyzerParameters['ScriptDefinition'] = '
31953195
class Test
31963196
{ [int] $Good
3197-
[Void] Bad()
3197+
[void] Bad()
31983198
{
31993199
}
32003200
}
@@ -3214,7 +3214,7 @@ Describe 'Measure-TypeDefinition' {
32143214
{
32153215
32163216
[int] $Good
3217-
[Void] Bad()
3217+
[void] Bad()
32183218
{
32193219
}
32203220
}
@@ -3233,7 +3233,7 @@ Describe 'Measure-TypeDefinition' {
32333233
Class Test
32343234
{
32353235
[int] $Good
3236-
[Void] Bad()
3236+
[void] Bad()
32373237
{
32383238
}
32393239
}

0 commit comments

Comments
 (0)