Skip to content

Commit 014dd71

Browse files
committed
Tests fpr PSAvoidPOsitionalParameters rule.
1 parent 956fcde commit 014dd71

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

Engine/Helper.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -629,18 +629,13 @@ public bool PositionalParameterUsed(CommandAst cmdAst, bool moreThanTwoPositiona
629629
return false;
630630
}
631631

632-
<<<<<<< 29f5017120de0ccf4c9737ca8a89d50ee66b63a1
633-
=======
634-
int parameters = 0;
635-
>>>>>>> Trigger AvoidPositionalParameters rule for function defined and called inside a sript given as argument to Script Analyzer.
636632
// Because of the way we count, we will also count the cmdlet as an argument so we have to -1
637633
int argumentsWithoutProcedingParameters = -1;
638634
bool parameterPreceding = false;
639635

640636
foreach (CommandElementAst ceAst in cmdAst.CommandElements)
641637
{
642638
var cmdParamAst = ceAst as CommandParameterAst;
643-
<<<<<<< 29f5017120de0ccf4c9737ca8a89d50ee66b63a1
644639
if (cmdParamAst != null)
645640
{
646641
parameterPreceding = true;
@@ -651,11 +646,6 @@ public bool PositionalParameterUsed(CommandAst cmdAst, bool moreThanTwoPositiona
651646
argumentsWithoutProcedingParameters += 1;
652647
}
653648
parameterPreceding = false;
654-
=======
655-
if (cmdParamAst == null)
656-
{
657-
arguments += 1;
658-
>>>>>>> Trigger AvoidPositionalParameters rule for function defined and called inside a sript given as argument to Script Analyzer.
659649
}
660650
}
661651

Rules/UseCmdletCorrectly.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,7 @@ private bool MandatoryParameterExists(CommandAst cmdAst)
129129
return true;
130130
}
131131

132-
<<<<<<< 29f5017120de0ccf4c9737ca8a89d50ee66b63a1
133132
if (mandParams.Count == 0 || (Helper.Instance.IsCmdlet(cmdAst) && Helper.Instance.PositionalParameterUsed(cmdAst)))
134-
=======
135-
if (mandParams.Count() == 0 || (Helper.Instance.IsCmdlet(cmdAst) && Helper.Instance.PositionalParameterUsed(cmdAst)))
136-
>>>>>>> Trigger AvoidPositionalParameters rule for function defined and called inside a sript given as argument to Script Analyzer.
137133
{
138134
returnValue = true;
139135
}

0 commit comments

Comments
 (0)