Skip to content

Commit

Permalink
Merge pull request PowerShell#107 from PowerShell/revert-102-revert-1…
Browse files Browse the repository at this point in the history
…01-revert-100-BugFixes

Revert the pull request
  • Loading branch information
yutingc committed May 6, 2015
2 parents 350816b + a29203d commit f12e076
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions Rules/ProvideVerboseMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation.Language;
using Microsoft.Windows.Powershell.ScriptAnalyzer.Generic;
using System.ComponentModel.Composition;
using System.Globalization;
using System.Management.Automation;

namespace Microsoft.Windows.Powershell.ScriptAnalyzer.BuiltinRules
{
Expand All @@ -35,11 +33,11 @@ public class ProvideVerboseMessage : SkipNamedBlock, IScriptRule
public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
{
if (ast == null) throw new ArgumentNullException(Strings.NullAstErrorMessage);

ClearList();
this.AddNames(new List<string>() { "Configuration", "Workflow" });
DiagnosticRecords.Clear();

this.fileName = fileName;
//We only check that advanced functions should have Write-Verbose
ast.Visit(this);
Expand All @@ -59,17 +57,6 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun
return AstVisitAction.SkipChildren;
}

//Write-Verbose is not required for non-advanced functions
if (funcAst.Body != null && funcAst.Body.ParamBlock != null
&& funcAst.Body.ParamBlock.Attributes != null &&
funcAst.Body.ParamBlock.Parameters != null)
{
if (!funcAst.Body.ParamBlock.Attributes.Any(attr => attr.TypeName.GetReflectionType() == typeof(CmdletBindingAttribute)))
{
return AstVisitAction.Continue;
}
}

var commandAsts = funcAst.Body.FindAll(testAst => testAst is CommandAst, false);
bool hasVerbose = false;

Expand Down

0 comments on commit f12e076

Please sign in to comment.