@@ -246,6 +246,8 @@ function Measure-FunctionBlockBraces
246
246
. DESCRIPTION
247
247
Each if-statement should have the opening brace on a separate line.
248
248
Also, the opening brace should be followed by a new line.
249
+ The if statement should also be in all lower case.
250
+ The else and elseif statements are not currently checked.
249
251
250
252
. EXAMPLE
251
253
Measure-IfStatement -IfStatementAst $ScriptBlockAst
@@ -305,6 +307,12 @@ function Measure-IfStatement
305
307
$script :diagnosticRecord [' Message' ] = $localizedData.IfStatementOpeningBraceShouldBeFollowedByOnlyOneNewLine
306
308
$script :diagnosticRecord -as $diagnosticRecordType
307
309
} # if
310
+
311
+ if (Test-StatementContainsUpperCase @testParameters )
312
+ {
313
+ $script :diagnosticRecord [' Message' ] = $localizedData.StatementsContainsUpperCaseLetter -f ' if'
314
+ $script :diagnosticRecord -as $diagnosticRecordType
315
+ } # if
308
316
}
309
317
catch
310
318
{
@@ -319,6 +327,7 @@ function Measure-IfStatement
319
327
. DESCRIPTION
320
328
Each foreach-statement should have the opening brace on a separate line.
321
329
Also, the opening brace should be followed by a new line.
330
+ The foreach statement should also be in all lower case.
322
331
323
332
. EXAMPLE
324
333
Measure-ForEachStatement -ForEachStatementAst $ScriptBlockAst
@@ -370,6 +379,12 @@ function Measure-ForEachStatement
370
379
$script :diagnosticRecord [' Message' ] = $localizedData.ForEachStatementOpeningBraceShouldBeFollowedByOnlyOneNewLine
371
380
$script :diagnosticRecord -as $diagnosticRecordType
372
381
} # if
382
+
383
+ if (Test-StatementContainsUpperCase @testParameters )
384
+ {
385
+ $script :diagnosticRecord [' Message' ] = $localizedData.StatementsContainsUpperCaseLetter -f ' foreach'
386
+ $script :diagnosticRecord -as $diagnosticRecordType
387
+ } # if
373
388
}
374
389
catch
375
390
{
@@ -384,6 +399,7 @@ function Measure-ForEachStatement
384
399
. DESCRIPTION
385
400
Each DoUntil-statement should have the opening brace on a separate line.
386
401
Also, the opening brace should be followed by a new line.
402
+ The do statement should also be in all lower case.
387
403
388
404
. EXAMPLE
389
405
Measure-DoUntilStatement -DoUntilStatementAst $ScriptBlockAst
@@ -435,6 +451,12 @@ function Measure-DoUntilStatement
435
451
$script :diagnosticRecord [' Message' ] = $localizedData.DoUntilStatementOpeningBraceShouldBeFollowedByOnlyOneNewLine
436
452
$script :diagnosticRecord -as $diagnosticRecordType
437
453
} # if
454
+
455
+ if (Test-StatementContainsUpperCase @testParameters )
456
+ {
457
+ $script :diagnosticRecord [' Message' ] = $localizedData.StatementsContainsUpperCaseLetter -f ' do'
458
+ $script :diagnosticRecord -as $diagnosticRecordType
459
+ } # if
438
460
}
439
461
catch
440
462
{
@@ -449,6 +471,7 @@ function Measure-DoUntilStatement
449
471
. DESCRIPTION
450
472
Each DoWhile-statement should have the opening brace on a separate line.
451
473
Also, the opening brace should be followed by a new line.
474
+ The do statement should also be in all lower case.
452
475
453
476
. EXAMPLE
454
477
Measure-DoWhileStatement -DoWhileStatementAst $ScriptBlockAst
@@ -500,6 +523,12 @@ function Measure-DoWhileStatement
500
523
$script :diagnosticRecord [' Message' ] = $localizedData.DoWhileStatementOpeningBraceShouldBeFollowedByOnlyOneNewLine
501
524
$script :diagnosticRecord -as $diagnosticRecordType
502
525
} # if
526
+
527
+ if (Test-StatementContainsUpperCase @testParameters )
528
+ {
529
+ $script :diagnosticRecord [' Message' ] = $localizedData.StatementsContainsUpperCaseLetter -f ' do'
530
+ $script :diagnosticRecord -as $diagnosticRecordType
531
+ } # if
503
532
}
504
533
catch
505
534
{
@@ -514,6 +543,7 @@ function Measure-DoWhileStatement
514
543
. DESCRIPTION
515
544
Each while-statement should have the opening brace on a separate line.
516
545
Also, the opening brace should be followed by a new line.
546
+ The while statement should also be in all lower case.
517
547
518
548
. EXAMPLE
519
549
Measure-WhileStatement -WhileStatementAst $ScriptBlockAst
@@ -565,6 +595,12 @@ function Measure-WhileStatement
565
595
$script :diagnosticRecord [' Message' ] = $localizedData.WhileStatementOpeningBraceShouldBeFollowedByOnlyOneNewLine
566
596
$script :diagnosticRecord -as $diagnosticRecordType
567
597
} # if
598
+
599
+ if (Test-StatementContainsUpperCase @testParameters )
600
+ {
601
+ $script :diagnosticRecord [' Message' ] = $localizedData.StatementsContainsUpperCaseLetter -f ' while'
602
+ $script :diagnosticRecord -as $diagnosticRecordType
603
+ } # if
568
604
}
569
605
catch
570
606
{
@@ -579,6 +615,7 @@ function Measure-WhileStatement
579
615
. DESCRIPTION
580
616
Each for-statement should have the opening brace on a separate line.
581
617
Also, the opening brace should be followed by a new line.
618
+ The for statement should also be in all lower case.
582
619
583
620
. EXAMPLE
584
621
Measure-ForStatement -ForStatementAst $ScriptBlockAst
@@ -630,6 +667,12 @@ function Measure-ForStatement
630
667
$script :diagnosticRecord [' Message' ] = $localizedData.ForStatementOpeningBraceShouldBeFollowedByOnlyOneNewLine
631
668
$script :diagnosticRecord -as $diagnosticRecordType
632
669
} # if
670
+
671
+ if (Test-StatementContainsUpperCase @testParameters )
672
+ {
673
+ $script :diagnosticRecord [' Message' ] = $localizedData.StatementsContainsUpperCaseLetter -f ' for'
674
+ $script :diagnosticRecord -as $diagnosticRecordType
675
+ } # if
633
676
}
634
677
catch
635
678
{
@@ -644,6 +687,7 @@ function Measure-ForStatement
644
687
. DESCRIPTION
645
688
Each switch-statement should have the opening brace on a separate line.
646
689
Also, the opening brace should be followed by a new line.
690
+ The switch statement should also be in all lower case.
647
691
648
692
. EXAMPLE
649
693
Measure-SwitchStatement -SwitchStatementAst $ScriptBlockAst
@@ -699,6 +743,12 @@ function Measure-SwitchStatement
699
743
$script :diagnosticRecord [' Message' ] = $localizedData.SwitchStatementOpeningBraceShouldBeFollowedByOnlyOneNewLine
700
744
$script :diagnosticRecord -as $diagnosticRecordType
701
745
} # if
746
+
747
+ if (Test-StatementContainsUpperCase @testParameters )
748
+ {
749
+ $script :diagnosticRecord [' Message' ] = $localizedData.StatementsContainsUpperCaseLetter -f ' switch'
750
+ $script :diagnosticRecord -as $diagnosticRecordType
751
+ } # if
702
752
}
703
753
catch
704
754
{
@@ -713,6 +763,7 @@ function Measure-SwitchStatement
713
763
. DESCRIPTION
714
764
Each try-statement should have the opening brace on a separate line.
715
765
Also, the opening brace should be followed by a new line.
766
+ The try statement should also be in all lower case.
716
767
717
768
. EXAMPLE
718
769
Measure-TryStatement -TryStatementAst $ScriptBlockAst
@@ -764,6 +815,12 @@ function Measure-TryStatement
764
815
$script :diagnosticRecord [' Message' ] = $localizedData.TryStatementOpeningBraceShouldBeFollowedByOnlyOneNewLine
765
816
$script :diagnosticRecord -as $diagnosticRecordType
766
817
} # if
818
+
819
+ if (Test-StatementContainsUpperCase @testParameters )
820
+ {
821
+ $script :diagnosticRecord [' Message' ] = $localizedData.StatementsContainsUpperCaseLetter -f ' try'
822
+ $script :diagnosticRecord -as $diagnosticRecordType
823
+ } # if
767
824
}
768
825
catch
769
826
{
@@ -778,6 +835,7 @@ function Measure-TryStatement
778
835
. DESCRIPTION
779
836
Each catch-clause should have the opening brace on a separate line.
780
837
Also, the opening brace should be followed by a new line.
838
+ The catch statement should also be in all lower case.
781
839
782
840
. EXAMPLE
783
841
Measure-CatchClause -CatchClauseAst $ScriptBlockAst
@@ -829,6 +887,12 @@ function Measure-CatchClause
829
887
$script :diagnosticRecord [' Message' ] = $localizedData.CatchClauseOpeningBraceShouldBeFollowedByOnlyOneNewLine
830
888
$script :diagnosticRecord -as $diagnosticRecordType
831
889
} # if
890
+
891
+ if (Test-StatementContainsUpperCase @testParameters )
892
+ {
893
+ $script :diagnosticRecord [' Message' ] = $localizedData.StatementsContainsUpperCaseLetter -f ' catch'
894
+ $script :diagnosticRecord -as $diagnosticRecordType
895
+ } # if
832
896
}
833
897
catch
834
898
{
@@ -842,6 +906,7 @@ function Measure-CatchClause
842
906
843
907
. DESCRIPTION
844
908
Each Class or Enum must be formatted correctly.
909
+ The class or enum statement should also be in all lower case.
845
910
846
911
. EXAMPLE
847
912
Measure-TypeDefinition -TypeDefinitionAst $ScriptBlockAst
@@ -895,6 +960,12 @@ function Measure-TypeDefinition
895
960
$script :diagnosticRecord [' Message' ] = $localizedData.EnumOpeningBraceShouldBeFollowedByOnlyOneNewLine
896
961
$script :diagnosticRecord -as $diagnosticRecordType
897
962
} # if
963
+
964
+ if (Test-StatementContainsUpperCase @testParameters )
965
+ {
966
+ $script :diagnosticRecord [' Message' ] = $localizedData.StatementsContainsUpperCaseLetter -f ' enum'
967
+ $script :diagnosticRecord -as $diagnosticRecordType
968
+ } # if
898
969
} # if
899
970
elseif ($TypeDefinitionAst.IsClass )
900
971
{
@@ -915,6 +986,12 @@ function Measure-TypeDefinition
915
986
$script :diagnosticRecord [' Message' ] = $localizedData.ClassOpeningBraceShouldBeFollowedByOnlyOneNewLine
916
987
$script :diagnosticRecord -as $diagnosticRecordType
917
988
} # if
989
+
990
+ if (Test-StatementContainsUpperCase @testParameters )
991
+ {
992
+ $script :diagnosticRecord [' Message' ] = $localizedData.StatementsContainsUpperCaseLetter -f ' class'
993
+ $script :diagnosticRecord -as $diagnosticRecordType
994
+ } # if
918
995
} # if
919
996
}
920
997
catch
0 commit comments