diff --git a/Engine/ScriptAnalyzer.cs b/Engine/ScriptAnalyzer.cs index 16d650e44..f49ffcb8c 100644 --- a/Engine/ScriptAnalyzer.cs +++ b/Engine/ScriptAnalyzer.cs @@ -861,10 +861,6 @@ private IEnumerable GetInterfaceImplementationsFromAssembly(string ruleDll "Creating Instance of {0}", type.Name)); var ruleObj = Activator.CreateInstance(type); - outputWriter.WriteVerbose( - string.Format( - "Created Instance of {0}", type.Name)); - T rule = ruleObj as T; if (rule == null) { @@ -1164,7 +1160,7 @@ internal IEnumerable GetExternalRecord(Ast ast, Token[] token, { // Find all AstTypes that appeared in rule groups. IEnumerable childAsts = ast.FindAll(new Func((testAst) => - (astRuleGroup.Key.IndexOf(testAst.GetType().FullName, StringComparison.OrdinalIgnoreCase) != -1)), false); + (astRuleGroup.Key.IndexOf(testAst.GetType().FullName, StringComparison.OrdinalIgnoreCase) != -1)), true); foreach (Ast childAst in childAsts) { diff --git a/Rules/AvoidAlias.cs b/Rules/AvoidAlias.cs index b2a95f3ea..aa7202000 100644 --- a/Rules/AvoidAlias.cs +++ b/Rules/AvoidAlias.cs @@ -37,7 +37,7 @@ public List WhiteList get { return whiteList; } } - AvoidAlias() + public AvoidAlias() { isPropertiesSet = false; } diff --git a/Rules/UseLiteralInitializerForHashtable.cs b/Rules/UseLiteralInitializerForHashtable.cs index b978f0b92..1d1f5f641 100644 --- a/Rules/UseLiteralInitializerForHashtable.cs +++ b/Rules/UseLiteralInitializerForHashtable.cs @@ -28,7 +28,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules #if !CORECLR [Export(typeof(IScriptRule))] #endif - class UseLiteralInitializerForHashtable : AstVisitor, IScriptRule + public class UseLiteralInitializerForHashtable : AstVisitor, IScriptRule { private List diagnosticRecords; private HashSet presetTypeNameSet; diff --git a/Tests/Rules/AvoidUsingAlias.tests.ps1 b/Tests/Rules/AvoidUsingAlias.tests.ps1 index f6d8005d2..4857c1c6b 100644 --- a/Tests/Rules/AvoidUsingAlias.tests.ps1 +++ b/Tests/Rules/AvoidUsingAlias.tests.ps1 @@ -33,7 +33,7 @@ Describe "AvoidUsingAlias" { } Context "Settings file provides whitelist" { - $whiteListTestScriptDef = 'gci; cd; iwr' + $whiteListTestScriptDef = 'gci; cd;' It "honors the whitelist provided as hashtable" { $settings = @{ @@ -44,14 +44,14 @@ Describe "AvoidUsingAlias" { } } $violations = Invoke-ScriptAnalyzer -ScriptDefinition $whiteListTestScriptDef -Settings $settings -IncludeRule $violationName - $violations.Count | Should Be 2 + $violations.Count | Should Be 1 } It "honors the whitelist provided through settings file" { # even though join-path returns string, if we do not use tostring, then invoke-scriptanalyzer cannot cast it to string type $settingsFilePath = (Join-Path $directory (Join-Path 'TestSettings' 'AvoidAliasSettings.psd1')).ToString() $violations = Invoke-ScriptAnalyzer -ScriptDefinition $whiteListTestScriptDef -Settings $settingsFilePath -IncludeRule $violationName - $violations.Count | Should be 2 + $violations.Count | Should be 1 } } } \ No newline at end of file