From a40d8db7add3cdcbcb8405cfb9a4ae6855d4c74e Mon Sep 17 00:00:00 2001 From: Pedro Amaral Date: Mon, 22 Oct 2018 11:37:17 +0100 Subject: [PATCH 1/4] Add summary comment to some rules with short description --- Rules/AlignAssignmentStatement.cs | 2 +- Rules/AvoidAssignmentToAutomaticVariable.cs | 2 +- Rules/AvoidGlobalAliases.cs | 3 +++ Rules/AvoidGlobalFunctions.cs | 3 +++ Rules/AvoidTrailingWhitespace.cs | 2 +- Rules/PlaceCloseBrace.cs | 2 +- Rules/UseCompatibleCmdlets.cs | 5 ++++- Rules/UseConsistentIndentation.cs | 2 +- Rules/UseConsistentWhitespace.cs | 2 +- Rules/UseLiteralInitializerForHashtable.cs | 2 +- Rules/UseSupportsShouldProcess.cs | 2 +- 11 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Rules/AlignAssignmentStatement.cs b/Rules/AlignAssignmentStatement.cs index d66ac1411..d8b1623d6 100644 --- a/Rules/AlignAssignmentStatement.cs +++ b/Rules/AlignAssignmentStatement.cs @@ -14,7 +14,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// - /// A class to walk an AST to check if consecutive assignment statements are aligned. + /// AlignAssignmentStatement: Checks if consecutive assignment statements are aligned. /// #if !CORECLR [Export(typeof(IScriptRule))] diff --git a/Rules/AvoidAssignmentToAutomaticVariable.cs b/Rules/AvoidAssignmentToAutomaticVariable.cs index e3b69ff57..086a47d17 100644 --- a/Rules/AvoidAssignmentToAutomaticVariable.cs +++ b/Rules/AvoidAssignmentToAutomaticVariable.cs @@ -14,7 +14,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// - /// AvoidAssignmentToAutomaticVariable: + /// AvoidAssignmentToAutomaticVariable: Checks for assignment to automatic variables /// #if !CORECLR [Export(typeof(IScriptRule))] diff --git a/Rules/AvoidGlobalAliases.cs b/Rules/AvoidGlobalAliases.cs index 20fee6285..afe7978e6 100644 --- a/Rules/AvoidGlobalAliases.cs +++ b/Rules/AvoidGlobalAliases.cs @@ -13,6 +13,9 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { + /// + /// AvoidGlobalAliases: Checks that global aliases are not used. + /// #if !CORECLR [Export(typeof(IScriptRule))] #endif diff --git a/Rules/AvoidGlobalFunctions.cs b/Rules/AvoidGlobalFunctions.cs index 8488018ac..da8f36f52 100644 --- a/Rules/AvoidGlobalFunctions.cs +++ b/Rules/AvoidGlobalFunctions.cs @@ -12,6 +12,9 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { + /// + /// AvoidGlobalFunctions: Checks that global functions are not used within modules. + /// #if !CORECLR [Export(typeof(IScriptRule))] #endif diff --git a/Rules/AvoidTrailingWhitespace.cs b/Rules/AvoidTrailingWhitespace.cs index c4afcd01d..987ff6dd9 100644 --- a/Rules/AvoidTrailingWhitespace.cs +++ b/Rules/AvoidTrailingWhitespace.cs @@ -14,7 +14,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// - /// A class to walk an AST to check for violation. + /// AvoidTrailingWhitespace: Checks for trailing whitespaces /// #if !CORECLR [Export(typeof(IScriptRule))] diff --git a/Rules/PlaceCloseBrace.cs b/Rules/PlaceCloseBrace.cs index 54e19fe6d..d9df57c75 100644 --- a/Rules/PlaceCloseBrace.cs +++ b/Rules/PlaceCloseBrace.cs @@ -14,7 +14,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// - /// A class to walk an AST to check for violation. + /// PlaceCloseBrace: Indicates if there should or should not be an empty line before a close brace. /// #if !CORECLR [Export(typeof(IScriptRule))] diff --git a/Rules/UseCompatibleCmdlets.cs b/Rules/UseCompatibleCmdlets.cs index c7df33764..bd597fa6a 100644 --- a/Rules/UseCompatibleCmdlets.cs +++ b/Rules/UseCompatibleCmdlets.cs @@ -18,11 +18,14 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// - /// A class to check if a script uses Cmdlets compatible with a given version and edition of PowerShell. + /// UseCompatibleCmdlets: Checks if a script uses Cmdlets compatible with a given version and edition of PowerShell. /// #if !CORECLR [Export(typeof(IScriptRule))] #endif + /// + /// A class to check if a script uses Cmdlets compatible with a given version and edition of PowerShell. + /// public class UseCompatibleCmdlets : AstVisitor, IScriptRule { private struct RuleParameters diff --git a/Rules/UseConsistentIndentation.cs b/Rules/UseConsistentIndentation.cs index c88e882bd..f3395cca5 100644 --- a/Rules/UseConsistentIndentation.cs +++ b/Rules/UseConsistentIndentation.cs @@ -14,7 +14,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// - /// A class to walk an AST to check for violation. + /// UseConsistentIndentation: Checks if indentation is consistent throughout the source file. /// #if !CORECLR [Export(typeof(IScriptRule))] diff --git a/Rules/UseConsistentWhitespace.cs b/Rules/UseConsistentWhitespace.cs index 12a47dfbd..b2cceb153 100644 --- a/Rules/UseConsistentWhitespace.cs +++ b/Rules/UseConsistentWhitespace.cs @@ -15,7 +15,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// - /// A class to walk an AST to check for [violation] + /// UseConsistentWhitespace: Checks if whitespace usage is consistent throughout the source file. /// #if !CORECLR [Export(typeof(IScriptRule))] diff --git a/Rules/UseLiteralInitializerForHashtable.cs b/Rules/UseLiteralInitializerForHashtable.cs index 260878bbb..44872c6a9 100644 --- a/Rules/UseLiteralInitializerForHashtable.cs +++ b/Rules/UseLiteralInitializerForHashtable.cs @@ -15,7 +15,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// - /// A class to walk an AST to check if hashtable is not initialized using [hashtable]::new or new-object hashtable + /// UseLiteralInitializerForHashtable: Checks if hashtable is not initialized using [hashtable]::new or new-object hashtable /// #if !CORECLR [Export(typeof(IScriptRule))] diff --git a/Rules/UseSupportsShouldProcess.cs b/Rules/UseSupportsShouldProcess.cs index 6d26e55cd..6e3fee657 100644 --- a/Rules/UseSupportsShouldProcess.cs +++ b/Rules/UseSupportsShouldProcess.cs @@ -15,7 +15,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// - /// A class to that implements the UseSupportsShouldProcess rule. + /// UseSupportsShouldProcess: Checks if a function defines Confirm and/or WhatIf parameters manually instead of using SupportShouldProcess attribute. /// #if !CORECLR [Export(typeof(IScriptRule))] From 86684b3dd6e37aea622ad1da53ab5fa3eda52895 Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Sat, 27 Oct 2018 13:03:05 +0100 Subject: [PATCH 2/4] correct typo --- Rules/UseSupportsShouldProcess.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rules/UseSupportsShouldProcess.cs b/Rules/UseSupportsShouldProcess.cs index 6e3fee657..a79fa4428 100644 --- a/Rules/UseSupportsShouldProcess.cs +++ b/Rules/UseSupportsShouldProcess.cs @@ -15,7 +15,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// - /// UseSupportsShouldProcess: Checks if a function defines Confirm and/or WhatIf parameters manually instead of using SupportShouldProcess attribute. + /// UseSupportsShouldProcess: Checks if a function defines Confirm and/or WhatIf parameters manually instead of using SupportsShouldProcess attribute. /// #if !CORECLR [Export(typeof(IScriptRule))] From 4e21a7637a2ef17daa97df92c423842d971f83f7 Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Sat, 27 Oct 2018 13:05:41 +0100 Subject: [PATCH 3/4] add period --- Rules/AvoidAssignmentToAutomaticVariable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rules/AvoidAssignmentToAutomaticVariable.cs b/Rules/AvoidAssignmentToAutomaticVariable.cs index 086a47d17..b6b427440 100644 --- a/Rules/AvoidAssignmentToAutomaticVariable.cs +++ b/Rules/AvoidAssignmentToAutomaticVariable.cs @@ -14,7 +14,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// - /// AvoidAssignmentToAutomaticVariable: Checks for assignment to automatic variables + /// AvoidAssignmentToAutomaticVariable: Checks for assignment to automatic variables. /// #if !CORECLR [Export(typeof(IScriptRule))] From a3c0c41b01884e4e59ce5e522cd1c1cbc26d6aec Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Sat, 27 Oct 2018 13:06:37 +0100 Subject: [PATCH 4/4] add period --- Rules/UseLiteralInitializerForHashtable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rules/UseLiteralInitializerForHashtable.cs b/Rules/UseLiteralInitializerForHashtable.cs index 44872c6a9..8f59d8332 100644 --- a/Rules/UseLiteralInitializerForHashtable.cs +++ b/Rules/UseLiteralInitializerForHashtable.cs @@ -15,7 +15,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// - /// UseLiteralInitializerForHashtable: Checks if hashtable is not initialized using [hashtable]::new or new-object hashtable + /// UseLiteralInitializerForHashtable: Checks if hashtable is not initialized using [hashtable]::new or new-object hashtable. /// #if !CORECLR [Export(typeof(IScriptRule))]