From 8a71a974811f3ee6efb2bb26c6dbee4f3a6cd82e Mon Sep 17 00:00:00 2001 From: Quoc Truong Date: Fri, 29 May 2015 11:06:34 -0700 Subject: [PATCH 1/2] Fix parameters missing in a conditional statement of the rule --- Rules/AvoidUsingPlainTextForPassword.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rules/AvoidUsingPlainTextForPassword.cs b/Rules/AvoidUsingPlainTextForPassword.cs index 4e6366bff..4a69c6812 100644 --- a/Rules/AvoidUsingPlainTextForPassword.cs +++ b/Rules/AvoidUsingPlainTextForPassword.cs @@ -55,8 +55,8 @@ public IEnumerable AnalyzeScript(Ast ast, string fileName) } } - if (hasPwd && (!paramType.IsArray && (paramType == typeof(String) || paramType == typeof(object))) - || (paramType.IsArray && (paramType.GetElementType() == typeof(String) || paramType.GetElementType() == typeof(object)))) + if (hasPwd && ((!paramType.IsArray && (paramType == typeof(String) || paramType == typeof(object))) + || (paramType.IsArray && (paramType.GetElementType() == typeof(String) || paramType.GetElementType() == typeof(object))))) { yield return new DiagnosticRecord( String.Format(CultureInfo.CurrentCulture, Strings.AvoidUsingPlainTextForPasswordError, paramAst.Name), From 5a5846440f3df2396be85e6ca5200aa15b787e11 Mon Sep 17 00:00:00 2001 From: Quoc Truong Date: Fri, 29 May 2015 11:32:05 -0700 Subject: [PATCH 2/2] Add test --- Tests/Rules/AvoidUsingPlainTextForPasswordNoViolations.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tests/Rules/AvoidUsingPlainTextForPasswordNoViolations.ps1 b/Tests/Rules/AvoidUsingPlainTextForPasswordNoViolations.ps1 index 3203dc0f4..0de5015ac 100644 --- a/Tests/Rules/AvoidUsingPlainTextForPasswordNoViolations.ps1 +++ b/Tests/Rules/AvoidUsingPlainTextForPasswordNoViolations.ps1 @@ -26,7 +26,9 @@ [securestring] $passwordparam, [string] - $PassThru + $PassThru, + [string[]] + $shouldnotraiseerror ) Begin