Skip to content

Change rule strict to information #12

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 2 commits into from
Apr 8, 2015
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/InvokeScriptAnalyzerCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public string[] IncludeRule
/// <summary>
/// IncludeRule: Array of the severity types to be enabled.
/// </summary>
[ValidateSet("Warning", "Error", "Strict", IgnoreCase = true)]
[ValidateSet("Warning", "Error", "Information", IgnoreCase = true)]
[Parameter(Mandatory = false)]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] Severity
Expand Down
4 changes: 2 additions & 2 deletions Engine/Generic/DiagnosticRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ public DiagnosticRecord(string message, IScriptExtent extent, string ruleName, D
public enum DiagnosticSeverity : uint
{
/// <summary>
/// STRICT: This diagnostic is trivial, but may be useful.
/// Information: This diagnostic is trivial, but may be useful.
/// </summary>
Strict = 0,
Information = 0,

/// <summary>
/// WARNING: This diagnostic may cause a problem or does not follow PowerShell's recommended guidelines.
Expand Down
2 changes: 1 addition & 1 deletion Rules/ProvideCommentHelp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun
DiagnosticRecords.Add(
new DiagnosticRecord(
string.Format(CultureInfo.CurrentCulture, Strings.ProvideCommentHelpError, funcAst.Name),
funcAst.Extent, GetName(), DiagnosticSeverity.Strict, fileName));
funcAst.Extent, GetName(), DiagnosticSeverity.Information, fileName));
}
}

Expand Down
2 changes: 1 addition & 1 deletion Rules/ProvideVerboseMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun
if (!hasVerbose)
{
DiagnosticRecords.Add(new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.ProvideVerboseMessageErrorFunction, funcAst.Name),
funcAst.Extent, GetName(), DiagnosticSeverity.Strict, fileName));
funcAst.Extent, GetName(), DiagnosticSeverity.Information, fileName));
}

return AstVisitAction.Continue;
Expand Down
12 changes: 6 additions & 6 deletions Rules/ReturnCorrectTypesForDSCFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ item is TypeDefinitionAst
foreach (Tuple<string, StatementAst> outputType in outputTypes)
{
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.ReturnCorrectTypesForSetTargetResourceFunctionsDSCError),
outputType.Item2.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
outputType.Item2.Extent, GetName(), DiagnosticSeverity.Information, fileName);
}
}
else
Expand All @@ -73,7 +73,7 @@ item is TypeDefinitionAst
else
{
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.ReturnCorrectTypesForGetTestTargetResourceFunctionsDSCResourceError,
func.Name, returnTypes[func.Name], type), outputType.Item2.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
func.Name, returnTypes[func.Name], type), outputType.Item2.Extent, GetName(), DiagnosticSeverity.Information, fileName);
}
}
}
Expand Down Expand Up @@ -116,7 +116,7 @@ item is TypeDefinitionAst
if (!String.Equals(funcAst.Name, "Set") && !Helper.Instance.AllCodePathReturns(funcAst))
{
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.NotAllCodePathReturnsDSCFunctionsError, funcAst.Name, dscClass.Name),
funcAst.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
funcAst.Extent, GetName(), DiagnosticSeverity.Information, fileName);
}

if (String.Equals(funcAst.Name, "Set"))
Expand All @@ -127,7 +127,7 @@ item is TypeDefinitionAst
if (ret.Pipeline != null)
{
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.ReturnCorrectTypesForSetFunctionsDSCError, dscClass.Name),
funcAst.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
funcAst.Extent, GetName(), DiagnosticSeverity.Information, fileName);
}
}
}
Expand All @@ -143,7 +143,7 @@ item is TypeDefinitionAst
{
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.ReturnCorrectTypesForDSCFunctionsNoTypeError,
funcAst.Name, dscClass.Name, returnTypes[funcAst.Name]),
ret.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
ret.Extent, GetName(), DiagnosticSeverity.Information, fileName);
}

string typeName = Helper.Instance.GetTypeFromReturnStatementAst(funcAst, ret, classes);
Expand All @@ -161,7 +161,7 @@ item is TypeDefinitionAst
{
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.ReturnCorrectTypesForDSCFunctionsWrongTypeError,
funcAst.Name, dscClass.Name, returnTypes[funcAst.Name], typeName),
ret.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
ret.Extent, GetName(), DiagnosticSeverity.Information, fileName);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Rules/UseIdenticalMandatoryParametersDSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
{
List<string> functionsNotContainingParam = expectedTargetResourceFunctionNames.Except(mandatoryParameters[paramName]).ToList();
yield return new DiagnosticRecord(string.Format(CultureInfo.InvariantCulture, Strings.UseIdenticalMandatoryParametersDSCError, paramName, string.Join(", ", functionsNotContainingParam.ToArray())),
ast.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
ast.Extent, GetName(), DiagnosticSeverity.Information, fileName);
}

}
Expand Down
4 changes: 2 additions & 2 deletions Rules/UseIdenticalParametersDSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
if (funcParamAsts.Count() != funcParamAsts2.Count())
{
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UseIdenticalParametersDSCError),
firstFunc.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
firstFunc.Extent, GetName(), DiagnosticSeverity.Information, fileName);
}

foreach (ParameterAst paramAst in funcParamAsts)
Expand All @@ -62,7 +62,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
|| !CompareParamAsts(paramAst, paramNames[paramAst.Name.VariablePath.UserPath]))
{
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UseIdenticalParametersDSCError),
paramAst.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
paramAst.Extent, GetName(), DiagnosticSeverity.Information, fileName);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Rules/UseStandardDSCFunctionsInResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
if (!targetResourceFunctionNamesInAst.Contains(expectedTargetResourceFunctionName, StringComparer.CurrentCultureIgnoreCase))
{
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UseStandardDSCFunctionsInResourceError, expectedTargetResourceFunctionName),
ast.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
ast.Extent, GetName(), DiagnosticSeverity.Information, fileName);
}
}
}
Expand Down Expand Up @@ -80,7 +80,7 @@ item is TypeDefinitionAst
if (!functions.Any(function => String.Equals(resourceFunctionName, (function as FunctionMemberAst).Name)))
{
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UseStandardDSCFunctionsInClassError, resourceFunctionName),
dscClass.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
dscClass.Extent, GetName(), DiagnosticSeverity.Information, fileName);
}
}
}
Expand Down