Skip to content

Commit f12e076

Browse files
committed
Merge pull request #107 from PowerShell/revert-102-revert-101-revert-100-BugFixes
Revert the pull request
2 parents 350816b + a29203d commit f12e076

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

Rules/ProvideVerboseMessage.cs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212

1313
using System;
1414
using System.Collections.Generic;
15-
using System.Linq;
1615
using System.Management.Automation.Language;
1716
using Microsoft.Windows.Powershell.ScriptAnalyzer.Generic;
1817
using System.ComponentModel.Composition;
1918
using System.Globalization;
20-
using System.Management.Automation;
2119

2220
namespace Microsoft.Windows.Powershell.ScriptAnalyzer.BuiltinRules
2321
{
@@ -35,11 +33,11 @@ public class ProvideVerboseMessage : SkipNamedBlock, IScriptRule
3533
public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
3634
{
3735
if (ast == null) throw new ArgumentNullException(Strings.NullAstErrorMessage);
38-
36+
3937
ClearList();
4038
this.AddNames(new List<string>() { "Configuration", "Workflow" });
4139
DiagnosticRecords.Clear();
42-
40+
4341
this.fileName = fileName;
4442
//We only check that advanced functions should have Write-Verbose
4543
ast.Visit(this);
@@ -59,17 +57,6 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun
5957
return AstVisitAction.SkipChildren;
6058
}
6159

62-
//Write-Verbose is not required for non-advanced functions
63-
if (funcAst.Body != null && funcAst.Body.ParamBlock != null
64-
&& funcAst.Body.ParamBlock.Attributes != null &&
65-
funcAst.Body.ParamBlock.Parameters != null)
66-
{
67-
if (!funcAst.Body.ParamBlock.Attributes.Any(attr => attr.TypeName.GetReflectionType() == typeof(CmdletBindingAttribute)))
68-
{
69-
return AstVisitAction.Continue;
70-
}
71-
}
72-
7360
var commandAsts = funcAst.Body.FindAll(testAst => testAst is CommandAst, false);
7461
bool hasVerbose = false;
7562

0 commit comments

Comments
 (0)