Skip to content

Remove unused using statements and sort them #931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Engine/Commands/GetScriptAnalyzerRuleCommand.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
6 changes: 1 addition & 5 deletions Engine/EditableText.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
5 changes: 0 additions & 5 deletions Engine/Generic/CorrectionExtent.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
1 change: 0 additions & 1 deletion Engine/Generic/DiagnosticRecord.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
4 changes: 2 additions & 2 deletions Engine/Generic/RuleSuppression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
8 changes: 3 additions & 5 deletions Engine/Helper.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion Engine/VariableAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 3 additions & 3 deletions Engine/VariableAnalysisBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
1 change: 0 additions & 1 deletion Rules/AvoidNullOrEmptyHelpMessageAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Rules/AvoidReservedCharInCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Rules/AvoidTrailingWhitespace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion Rules/AvoidUserNameAndPasswordParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using System.ComponentModel.Composition;
#endif
using System.Globalization;
using System.Reflection;

namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
{
Expand Down
1 change: 0 additions & 1 deletion Rules/AvoidUsingComputerNameHardcoded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions Rules/AvoidUsingPlainTextForPassword.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
using System.ComponentModel.Composition;
#endif
using System.Globalization;
using System.Reflection;
using System.Text;

namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
{
Expand Down
2 changes: 1 addition & 1 deletion Rules/DscExamplesPresent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </summary>
#if !CORECLR
#if !CORECLR
[Export(typeof(IDSCResourceRule))]
#endif
public class DscExamplesPresent : IDSCResourceRule
Expand Down
2 changes: 1 addition & 1 deletion Rules/DscTestsPresent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </summary>
#if !CORECLR
#if !CORECLR
[Export(typeof(IDSCResourceRule))]
#endif
public class DscTestsPresent : IDSCResourceRule
Expand Down
5 changes: 0 additions & 5 deletions Rules/LoggerInfo.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion Rules/MissingModuleManifestField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.ComponentModel.Composition;
#endif
using System.Globalization;
using System.Text;

namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
{
Expand Down
1 change: 0 additions & 1 deletion Rules/PlaceOpenBrace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions Rules/ProvideCommentHelp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion Rules/ReturnCorrectTypesForDSCFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
/// <summary>
/// ReturnCorrectTypeDSCFunctions: Check that DSC functions return the correct type.
/// </summary>
#if !CORECLR
#if !CORECLR
[Export(typeof(IDSCResourceRule))]
#endif
public class ReturnCorrectTypesForDSCFunctions : IDSCResourceRule
Expand Down
3 changes: 1 addition & 2 deletions Rules/UseCompatibleCmdlets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -21,7 +20,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
/// <summary>
/// A class to check if a script uses Cmdlets compatible with a given version and edition of PowerShell.
/// </summary>
#if !CORECLR
#if !CORECLR
[Export(typeof(IScriptRule))]
#endif
public class UseCompatibleCmdlets : AstVisitor, IScriptRule
Expand Down
2 changes: 1 addition & 1 deletion Rules/UseIdenticalParametersDSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
/// UseIdenticalParametersDSC: Check that the Test-TargetResource and
/// Set-TargetResource have identical parameters.
/// </summary>
#if !CORECLR
#if !CORECLR
[Export(typeof(IDSCResourceRule))]
#endif
public class UseIdenticalParametersDSC : IDSCResourceRule
Expand Down
3 changes: 1 addition & 2 deletions Rules/UseLiteralInitializerForHashtable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -18,7 +17,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
/// <summary>
/// A class to walk an AST to check if hashtable is not initialized using [hashtable]::new or new-object hashtable
/// </summary>
#if !CORECLR
#if !CORECLR
[Export(typeof(IScriptRule))]
#endif
public class UseLiteralInitializerForHashtable : AstVisitor, IScriptRule
Expand Down
1 change: 0 additions & 1 deletion Rules/UsePSCredentialType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Rules/UseStandardDSCFunctionsInResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
/// <summary>
/// UseStandardDSCFunctionsInResource: Checks if the DSC resource uses standard Get/Set/Test TargetResource functions.
/// </summary>
#if !CORECLR
#if !CORECLR
[Export(typeof(IDSCResourceRule))]
#endif
public class UseStandardDSCFunctionsInResource : IDSCResourceRule
Expand Down
1 change: 0 additions & 1 deletion Rules/UseToExportFieldsInManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#if !CORECLR
using System.ComponentModel.Composition;
#endif
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Text;
using System.Globalization;
Expand Down
3 changes: 1 addition & 2 deletions Rules/UseVerboseMessageInDSCResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
using System.ComponentModel.Composition;
#endif
using System.Globalization;
using System.Management.Automation;

namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
{
/// <summary>
/// UseVerboseMessageInDSCResource: Analyzes the ast to check that Write-Verbose is called for DSC Resources.
/// </summary>
#if !CORECLR
#if !CORECLR
[Export(typeof(IDSCResourceRule))]
#endif
public class UseVerboseMessageInDSCResource : SkipNamedBlock, IDSCResourceRule
Expand Down
1 change: 0 additions & 1 deletion rules/UseSupportsShouldProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
#if !CORECLR
using System.ComponentModel.Composition;
Expand Down