diff --git a/Engine/Commands/GetScriptAnalyzerRuleCommand.cs b/Engine/Commands/GetScriptAnalyzerRuleCommand.cs index 001876c91..254f55cc6 100644 --- a/Engine/Commands/GetScriptAnalyzerRuleCommand.cs +++ b/Engine/Commands/GetScriptAnalyzerRuleCommand.cs @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using System.Management.Automation; -using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands { diff --git a/Engine/EditableText.cs b/Engine/EditableText.cs index afcded726..22e072fd0 100644 --- a/Engine/EditableText.cs +++ b/Engine/EditableText.cs @@ -1,15 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using Microsoft.Windows.PowerShell.ScriptAnalyzer.Extensions; using System; -using System.Collections; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Linq; -using System.Management.Automation.Language; -using System.Text; -using Microsoft.Windows.PowerShell.ScriptAnalyzer.Extensions; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer { diff --git a/Engine/Generic/CorrectionExtent.cs b/Engine/Generic/CorrectionExtent.cs index a9003b8f2..caad49cdb 100644 --- a/Engine/Generic/CorrectionExtent.cs +++ b/Engine/Generic/CorrectionExtent.cs @@ -1,13 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; using System.Collections.Generic; -using System.IO; -using System.Linq; using System.Management.Automation.Language; -using System.Text; -using System.Threading.Tasks; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic { diff --git a/Engine/Generic/DiagnosticRecord.cs b/Engine/Generic/DiagnosticRecord.cs index c283ae025..ca3c3c882 100644 --- a/Engine/Generic/DiagnosticRecord.cs +++ b/Engine/Generic/DiagnosticRecord.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; using System.Collections.Generic; using System.Management.Automation.Language; diff --git a/Engine/Generic/RuleSuppression.cs b/Engine/Generic/RuleSuppression.cs index 19a32c267..bdf023096 100644 --- a/Engine/Generic/RuleSuppression.cs +++ b/Engine/Generic/RuleSuppression.cs @@ -2,11 +2,11 @@ // Licensed under the MIT License. using System; +using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Management.Automation.Language; -using System.Collections.Generic; using System.Text.RegularExpressions; -using System.Globalization; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic { diff --git a/Engine/Helper.cs b/Engine/Helper.cs index c7dce3c1b..9e74d2b4b 100644 --- a/Engine/Helper.cs +++ b/Engine/Helper.cs @@ -1,18 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic; using System; +using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Globalization; using System.IO; using System.Linq; using System.Management.Automation; using System.Management.Automation.Language; -using System.Globalization; -using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic; -using System.Management.Automation.Runspaces; -using System.Collections; -using System.Reflection; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer { diff --git a/Engine/VariableAnalysis.cs b/Engine/VariableAnalysis.cs index f18d05121..3434a8877 100644 --- a/Engine/VariableAnalysis.cs +++ b/Engine/VariableAnalysis.cs @@ -3,9 +3,9 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Management.Automation.Language; -using System.Globalization; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer { diff --git a/Engine/VariableAnalysisBase.cs b/Engine/VariableAnalysisBase.cs index e66712850..8e366a952 100644 --- a/Engine/VariableAnalysisBase.cs +++ b/Engine/VariableAnalysisBase.cs @@ -5,11 +5,11 @@ using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Globalization; using System.Linq; -using System.Reflection; -using System.Management.Automation.Language; using System.Management.Automation; -using System.Globalization; +using System.Management.Automation.Language; +using System.Reflection; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer { diff --git a/Rules/AvoidNullOrEmptyHelpMessageAttribute.cs b/Rules/AvoidNullOrEmptyHelpMessageAttribute.cs index 756a6f039..3dbe949d9 100644 --- a/Rules/AvoidNullOrEmptyHelpMessageAttribute.cs +++ b/Rules/AvoidNullOrEmptyHelpMessageAttribute.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Management.Automation.Language; using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic; #if !CORECLR diff --git a/Rules/AvoidReservedCharInCmdlet.cs b/Rules/AvoidReservedCharInCmdlet.cs index f5f6a610c..e4ae3de6e 100644 --- a/Rules/AvoidReservedCharInCmdlet.cs +++ b/Rules/AvoidReservedCharInCmdlet.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Management.Automation.Language; using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic; -using Microsoft.Windows.PowerShell.ScriptAnalyzer; #if !CORECLR using System.ComponentModel.Composition; #endif diff --git a/Rules/AvoidTrailingWhitespace.cs b/Rules/AvoidTrailingWhitespace.cs index 3a3cc169f..c4afcd01d 100644 --- a/Rules/AvoidTrailingWhitespace.cs +++ b/Rules/AvoidTrailingWhitespace.cs @@ -8,7 +8,6 @@ using System.ComponentModel.Composition; #endif using System.Globalization; -using System.Linq; using System.Management.Automation.Language; using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic; diff --git a/Rules/AvoidUserNameAndPasswordParams.cs b/Rules/AvoidUserNameAndPasswordParams.cs index 40a128b28..9429e2aa4 100644 --- a/Rules/AvoidUserNameAndPasswordParams.cs +++ b/Rules/AvoidUserNameAndPasswordParams.cs @@ -11,7 +11,6 @@ using System.ComponentModel.Composition; #endif using System.Globalization; -using System.Reflection; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { diff --git a/Rules/AvoidUsingComputerNameHardcoded.cs b/Rules/AvoidUsingComputerNameHardcoded.cs index 2d5a9c795..2202abe1d 100644 --- a/Rules/AvoidUsingComputerNameHardcoded.cs +++ b/Rules/AvoidUsingComputerNameHardcoded.cs @@ -8,7 +8,6 @@ using System.ComponentModel.Composition; #endif using System.Globalization; -using System.Collections.Generic; using System.Linq; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules diff --git a/Rules/AvoidUsingPlainTextForPassword.cs b/Rules/AvoidUsingPlainTextForPassword.cs index c2a4df5f2..f44585afc 100644 --- a/Rules/AvoidUsingPlainTextForPassword.cs +++ b/Rules/AvoidUsingPlainTextForPassword.cs @@ -9,8 +9,6 @@ using System.ComponentModel.Composition; #endif using System.Globalization; -using System.Reflection; -using System.Text; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { diff --git a/Rules/DscExamplesPresent.cs b/Rules/DscExamplesPresent.cs index 9b78b61da..331991d02 100644 --- a/Rules/DscExamplesPresent.cs +++ b/Rules/DscExamplesPresent.cs @@ -21,7 +21,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules /// For class based resources it should be present at the same folder level as resource psm1 file. /// Examples folder should contain sample configuration for given resource - file name should contain resource's name. /// - #if !CORECLR +#if !CORECLR [Export(typeof(IDSCResourceRule))] #endif public class DscExamplesPresent : IDSCResourceRule diff --git a/Rules/DscTestsPresent.cs b/Rules/DscTestsPresent.cs index 23d921b46..21dbf10da 100644 --- a/Rules/DscTestsPresent.cs +++ b/Rules/DscTestsPresent.cs @@ -21,7 +21,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules /// For class based resources it should be present at the same folder level as resource psm1 file. /// Tests folder should contain test script for given resource - file name should contain resource's name. /// - #if !CORECLR +#if !CORECLR [Export(typeof(IDSCResourceRule))] #endif public class DscTestsPresent : IDSCResourceRule diff --git a/Rules/LoggerInfo.cs b/Rules/LoggerInfo.cs index f9255b7d6..04ce89cb7 100644 --- a/Rules/LoggerInfo.cs +++ b/Rules/LoggerInfo.cs @@ -1,11 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Diagnostics.CodeAnalysis; namespace Microsoft.Windows.Powershell.ScriptAnalyzer.Generic diff --git a/Rules/MissingModuleManifestField.cs b/Rules/MissingModuleManifestField.cs index 35fa0f021..78deb38ab 100644 --- a/Rules/MissingModuleManifestField.cs +++ b/Rules/MissingModuleManifestField.cs @@ -10,7 +10,6 @@ using System.ComponentModel.Composition; #endif using System.Globalization; -using System.Text; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { diff --git a/Rules/PlaceOpenBrace.cs b/Rules/PlaceOpenBrace.cs index 9b687a50c..ea6bab634 100644 --- a/Rules/PlaceOpenBrace.cs +++ b/Rules/PlaceOpenBrace.cs @@ -7,7 +7,6 @@ using System.ComponentModel.Composition; #endif using System.Globalization; -using System.Linq; using System.Management.Automation.Language; using System.Text; using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic; diff --git a/Rules/ProvideCommentHelp.cs b/Rules/ProvideCommentHelp.cs index c6f7c3661..3384debef 100644 --- a/Rules/ProvideCommentHelp.cs +++ b/Rules/ProvideCommentHelp.cs @@ -10,9 +10,7 @@ using System.ComponentModel.Composition; #endif using System.Globalization; -using System.Management.Automation; using System.Text; -using System.IO; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { diff --git a/Rules/ReturnCorrectTypesForDSCFunctions.cs b/Rules/ReturnCorrectTypesForDSCFunctions.cs index 93dd50ec8..693b7429f 100644 --- a/Rules/ReturnCorrectTypesForDSCFunctions.cs +++ b/Rules/ReturnCorrectTypesForDSCFunctions.cs @@ -16,7 +16,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules /// /// ReturnCorrectTypeDSCFunctions: Check that DSC functions return the correct type. /// - #if !CORECLR +#if !CORECLR [Export(typeof(IDSCResourceRule))] #endif public class ReturnCorrectTypesForDSCFunctions : IDSCResourceRule diff --git a/Rules/UseCompatibleCmdlets.cs b/Rules/UseCompatibleCmdlets.cs index 687cd6fbb..f74061b76 100644 --- a/Rules/UseCompatibleCmdlets.cs +++ b/Rules/UseCompatibleCmdlets.cs @@ -10,7 +10,6 @@ using System.IO; using System.Linq; using System.Management.Automation.Language; -using System.Reflection; using System.Text.RegularExpressions; using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic; @@ -21,7 +20,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules /// /// A class to check if a script uses Cmdlets compatible with a given version and edition of PowerShell. /// - #if !CORECLR +#if !CORECLR [Export(typeof(IScriptRule))] #endif public class UseCompatibleCmdlets : AstVisitor, IScriptRule diff --git a/Rules/UseIdenticalParametersDSC.cs b/Rules/UseIdenticalParametersDSC.cs index 13758e858..785db5066 100644 --- a/Rules/UseIdenticalParametersDSC.cs +++ b/Rules/UseIdenticalParametersDSC.cs @@ -17,7 +17,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules /// UseIdenticalParametersDSC: Check that the Test-TargetResource and /// Set-TargetResource have identical parameters. /// - #if !CORECLR +#if !CORECLR [Export(typeof(IDSCResourceRule))] #endif public class UseIdenticalParametersDSC : IDSCResourceRule diff --git a/Rules/UseLiteralInitializerForHashtable.cs b/Rules/UseLiteralInitializerForHashtable.cs index d5426d2fa..260878bbb 100644 --- a/Rules/UseLiteralInitializerForHashtable.cs +++ b/Rules/UseLiteralInitializerForHashtable.cs @@ -9,7 +9,6 @@ using System.ComponentModel.Composition; #endif using System.Globalization; -using System.Linq; using System.Management.Automation.Language; using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic; @@ -18,7 +17,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 /// - #if !CORECLR +#if !CORECLR [Export(typeof(IScriptRule))] #endif public class UseLiteralInitializerForHashtable : AstVisitor, IScriptRule diff --git a/Rules/UsePSCredentialType.cs b/Rules/UsePSCredentialType.cs index 80eb142e6..de0b2e5a5 100644 --- a/Rules/UsePSCredentialType.cs +++ b/Rules/UsePSCredentialType.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System; -using System.Reflection; using System.Linq; using System.Collections.Generic; using System.Management.Automation; diff --git a/Rules/UseStandardDSCFunctionsInResource.cs b/Rules/UseStandardDSCFunctionsInResource.cs index 7499ab828..548414b06 100644 --- a/Rules/UseStandardDSCFunctionsInResource.cs +++ b/Rules/UseStandardDSCFunctionsInResource.cs @@ -16,7 +16,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules /// /// UseStandardDSCFunctionsInResource: Checks if the DSC resource uses standard Get/Set/Test TargetResource functions. /// - #if !CORECLR +#if !CORECLR [Export(typeof(IDSCResourceRule))] #endif public class UseStandardDSCFunctionsInResource : IDSCResourceRule diff --git a/Rules/UseToExportFieldsInManifest.cs b/Rules/UseToExportFieldsInManifest.cs index cfc368244..bfd99db9e 100644 --- a/Rules/UseToExportFieldsInManifest.cs +++ b/Rules/UseToExportFieldsInManifest.cs @@ -10,7 +10,6 @@ #if !CORECLR using System.ComponentModel.Composition; #endif -using System.Text.RegularExpressions; using System.Diagnostics; using System.Text; using System.Globalization; diff --git a/Rules/UseVerboseMessageInDSCResource.cs b/Rules/UseVerboseMessageInDSCResource.cs index a393f4910..d6038544f 100644 --- a/Rules/UseVerboseMessageInDSCResource.cs +++ b/Rules/UseVerboseMessageInDSCResource.cs @@ -10,14 +10,13 @@ using System.ComponentModel.Composition; #endif using System.Globalization; -using System.Management.Automation; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules { /// /// UseVerboseMessageInDSCResource: Analyzes the ast to check that Write-Verbose is called for DSC Resources. /// - #if !CORECLR +#if !CORECLR [Export(typeof(IDSCResourceRule))] #endif public class UseVerboseMessageInDSCResource : SkipNamedBlock, IDSCResourceRule diff --git a/rules/UseSupportsShouldProcess.cs b/rules/UseSupportsShouldProcess.cs index e188abed7..6d26e55cd 100644 --- a/rules/UseSupportsShouldProcess.cs +++ b/rules/UseSupportsShouldProcess.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using System.Text; using System.Collections.Generic; #if !CORECLR using System.ComponentModel.Composition;