Skip to content

Commit 6146546

Browse files
bergmeisterJamesWTruher
authored andcommitted
Remove unused using statements and sort them (#931)
* Remove and sort usings * re-add accidentally removed using
1 parent 3cd2910 commit 6146546

29 files changed

+19
-53
lines changed

Engine/Commands/GetScriptAnalyzerRuleCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
45
using System;
56
using System.Collections.Generic;
67
using System.Diagnostics.CodeAnalysis;
78
using System.Globalization;
89
using System.Linq;
910
using System.Management.Automation;
10-
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
1111

1212
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands
1313
{

Engine/EditableText.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Extensions;
45
using System;
5-
using System.Collections;
6-
using System.Collections.Generic;
76
using System.Collections.ObjectModel;
87
using System.Globalization;
98
using System.Linq;
10-
using System.Management.Automation.Language;
11-
using System.Text;
12-
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Extensions;
139

1410
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer
1511
{

Engine/Generic/CorrectionExtent.cs

-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
using System;
54
using System.Collections.Generic;
6-
using System.IO;
7-
using System.Linq;
85
using System.Management.Automation.Language;
9-
using System.Text;
10-
using System.Threading.Tasks;
116

127
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic
138
{

Engine/Generic/DiagnosticRecord.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
using System;
54
using System.Collections.Generic;
65
using System.Management.Automation.Language;
76

Engine/Generic/RuleSuppression.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// Licensed under the MIT License.
33

44
using System;
5+
using System.Collections.Generic;
6+
using System.Globalization;
57
using System.Linq;
68
using System.Management.Automation.Language;
7-
using System.Collections.Generic;
89
using System.Text.RegularExpressions;
9-
using System.Globalization;
1010

1111
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic
1212
{

Engine/Helper.cs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
45
using System;
6+
using System.Collections;
57
using System.Collections.Generic;
68
using System.Collections.ObjectModel;
9+
using System.Globalization;
710
using System.IO;
811
using System.Linq;
912
using System.Management.Automation;
1013
using System.Management.Automation.Language;
11-
using System.Globalization;
12-
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
13-
using System.Management.Automation.Runspaces;
14-
using System.Collections;
15-
using System.Reflection;
1614

1715
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer
1816
{

Engine/VariableAnalysis.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
using System;
55
using System.Collections.Generic;
6+
using System.Globalization;
67
using System.Linq;
78
using System.Management.Automation.Language;
8-
using System.Globalization;
99

1010
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer
1111
{

Engine/VariableAnalysisBase.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
using System.Collections;
66
using System.Collections.Generic;
77
using System.Collections.ObjectModel;
8+
using System.Globalization;
89
using System.Linq;
9-
using System.Reflection;
10-
using System.Management.Automation.Language;
1110
using System.Management.Automation;
12-
using System.Globalization;
11+
using System.Management.Automation.Language;
12+
using System.Reflection;
1313

1414
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer
1515
{

Rules/AvoidNullOrEmptyHelpMessageAttribute.cs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System;
55
using System.Collections.Generic;
6-
using System.Linq;
76
using System.Management.Automation.Language;
87
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
98
#if !CORECLR

Rules/AvoidReservedCharInCmdlet.cs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Linq;
77
using System.Management.Automation.Language;
88
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
9-
using Microsoft.Windows.PowerShell.ScriptAnalyzer;
109
#if !CORECLR
1110
using System.ComponentModel.Composition;
1211
#endif

Rules/AvoidTrailingWhitespace.cs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.ComponentModel.Composition;
99
#endif
1010
using System.Globalization;
11-
using System.Linq;
1211
using System.Management.Automation.Language;
1312
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
1413

Rules/AvoidUserNameAndPasswordParams.cs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using System.ComponentModel.Composition;
1212
#endif
1313
using System.Globalization;
14-
using System.Reflection;
1514

1615
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
1716
{

Rules/AvoidUsingComputerNameHardcoded.cs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.ComponentModel.Composition;
99
#endif
1010
using System.Globalization;
11-
using System.Collections.Generic;
1211
using System.Linq;
1312

1413
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules

Rules/AvoidUsingPlainTextForPassword.cs

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
using System.ComponentModel.Composition;
1010
#endif
1111
using System.Globalization;
12-
using System.Reflection;
13-
using System.Text;
1412

1513
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
1614
{

Rules/DscExamplesPresent.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
2121
/// For class based resources it should be present at the same folder level as resource psm1 file.
2222
/// Examples folder should contain sample configuration for given resource - file name should contain resource's name.
2323
/// </summary>
24-
#if !CORECLR
24+
#if !CORECLR
2525
[Export(typeof(IDSCResourceRule))]
2626
#endif
2727
public class DscExamplesPresent : IDSCResourceRule

Rules/DscTestsPresent.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
2121
/// For class based resources it should be present at the same folder level as resource psm1 file.
2222
/// Tests folder should contain test script for given resource - file name should contain resource's name.
2323
/// </summary>
24-
#if !CORECLR
24+
#if !CORECLR
2525
[Export(typeof(IDSCResourceRule))]
2626
#endif
2727
public class DscTestsPresent : IDSCResourceRule

Rules/LoggerInfo.cs

-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
using System;
5-
using System.Collections.Generic;
6-
using System.Linq;
7-
using System.Text;
8-
using System.Threading.Tasks;
94
using System.Diagnostics.CodeAnalysis;
105

116
namespace Microsoft.Windows.Powershell.ScriptAnalyzer.Generic

Rules/MissingModuleManifestField.cs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using System.ComponentModel.Composition;
1111
#endif
1212
using System.Globalization;
13-
using System.Text;
1413

1514
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
1615
{

Rules/PlaceOpenBrace.cs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using System.ComponentModel.Composition;
88
#endif
99
using System.Globalization;
10-
using System.Linq;
1110
using System.Management.Automation.Language;
1211
using System.Text;
1312
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;

Rules/ProvideCommentHelp.cs

-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
using System.ComponentModel.Composition;
1111
#endif
1212
using System.Globalization;
13-
using System.Management.Automation;
1413
using System.Text;
15-
using System.IO;
1614

1715
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
1816
{

Rules/ReturnCorrectTypesForDSCFunctions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
1616
/// <summary>
1717
/// ReturnCorrectTypeDSCFunctions: Check that DSC functions return the correct type.
1818
/// </summary>
19-
#if !CORECLR
19+
#if !CORECLR
2020
[Export(typeof(IDSCResourceRule))]
2121
#endif
2222
public class ReturnCorrectTypesForDSCFunctions : IDSCResourceRule

Rules/UseCompatibleCmdlets.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using System.IO;
1111
using System.Linq;
1212
using System.Management.Automation.Language;
13-
using System.Reflection;
1413
using System.Text.RegularExpressions;
1514
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
1615

@@ -21,7 +20,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
2120
/// <summary>
2221
/// A class to check if a script uses Cmdlets compatible with a given version and edition of PowerShell.
2322
/// </summary>
24-
#if !CORECLR
23+
#if !CORECLR
2524
[Export(typeof(IScriptRule))]
2625
#endif
2726
public class UseCompatibleCmdlets : AstVisitor, IScriptRule

Rules/UseIdenticalParametersDSC.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
1717
/// UseIdenticalParametersDSC: Check that the Test-TargetResource and
1818
/// Set-TargetResource have identical parameters.
1919
/// </summary>
20-
#if !CORECLR
20+
#if !CORECLR
2121
[Export(typeof(IDSCResourceRule))]
2222
#endif
2323
public class UseIdenticalParametersDSC : IDSCResourceRule

Rules/UseLiteralInitializerForHashtable.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using System.ComponentModel.Composition;
1010
#endif
1111
using System.Globalization;
12-
using System.Linq;
1312
using System.Management.Automation.Language;
1413
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
1514

@@ -18,7 +17,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
1817
/// <summary>
1918
/// A class to walk an AST to check if hashtable is not initialized using [hashtable]::new or new-object hashtable
2019
/// </summary>
21-
#if !CORECLR
20+
#if !CORECLR
2221
[Export(typeof(IScriptRule))]
2322
#endif
2423
public class UseLiteralInitializerForHashtable : AstVisitor, IScriptRule

Rules/UsePSCredentialType.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License.
33

44
using System;
5-
using System.Reflection;
65
using System.Linq;
76
using System.Collections.Generic;
87
using System.Management.Automation;

Rules/UseStandardDSCFunctionsInResource.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
1616
/// <summary>
1717
/// UseStandardDSCFunctionsInResource: Checks if the DSC resource uses standard Get/Set/Test TargetResource functions.
1818
/// </summary>
19-
#if !CORECLR
19+
#if !CORECLR
2020
[Export(typeof(IDSCResourceRule))]
2121
#endif
2222
public class UseStandardDSCFunctionsInResource : IDSCResourceRule

Rules/UseToExportFieldsInManifest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#if !CORECLR
1111
using System.ComponentModel.Composition;
1212
#endif
13-
using System.Text.RegularExpressions;
1413
using System.Diagnostics;
1514
using System.Text;
1615
using System.Globalization;

Rules/UseVerboseMessageInDSCResource.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
using System.ComponentModel.Composition;
1111
#endif
1212
using System.Globalization;
13-
using System.Management.Automation;
1413

1514
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
1615
{
1716
/// <summary>
1817
/// UseVerboseMessageInDSCResource: Analyzes the ast to check that Write-Verbose is called for DSC Resources.
1918
/// </summary>
20-
#if !CORECLR
19+
#if !CORECLR
2120
[Export(typeof(IDSCResourceRule))]
2221
#endif
2322
public class UseVerboseMessageInDSCResource : SkipNamedBlock, IDSCResourceRule

rules/UseSupportsShouldProcess.cs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System;
55
using System.Linq;
6-
using System.Text;
76
using System.Collections.Generic;
87
#if !CORECLR
98
using System.ComponentModel.Composition;

0 commit comments

Comments
 (0)