Skip to content

Commit dba3417

Browse files
committed
Merge pull request #12 from PowerShell/yuting-changes
Change rule strict to information
2 parents ca4a2b1 + 4ed4861 commit dba3417

8 files changed

+16
-16
lines changed

Engine/Commands/InvokeScriptAnalyzerCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public string[] IncludeRule
7777
/// <summary>
7878
/// IncludeRule: Array of the severity types to be enabled.
7979
/// </summary>
80-
[ValidateSet("Warning", "Error", "Strict", IgnoreCase = true)]
80+
[ValidateSet("Warning", "Error", "Information", IgnoreCase = true)]
8181
[Parameter(Mandatory = false)]
8282
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
8383
public string[] Severity

Engine/Generic/DiagnosticRecord.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ public DiagnosticRecord(string message, IScriptExtent extent, string ruleName, D
9898
public enum DiagnosticSeverity : uint
9999
{
100100
/// <summary>
101-
/// STRICT: This diagnostic is trivial, but may be useful.
101+
/// Information: This diagnostic is trivial, but may be useful.
102102
/// </summary>
103-
Strict = 0,
103+
Information = 0,
104104

105105
/// <summary>
106106
/// WARNING: This diagnostic may cause a problem or does not follow PowerShell's recommended guidelines.

Rules/ProvideCommentHelp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun
5656
DiagnosticRecords.Add(
5757
new DiagnosticRecord(
5858
string.Format(CultureInfo.CurrentCulture, Strings.ProvideCommentHelpError, funcAst.Name),
59-
funcAst.Extent, GetName(), DiagnosticSeverity.Strict, fileName));
59+
funcAst.Extent, GetName(), DiagnosticSeverity.Information, fileName));
6060
}
6161
}
6262

Rules/ProvideVerboseMessage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun
6565
if (!hasVerbose)
6666
{
6767
DiagnosticRecords.Add(new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.ProvideVerboseMessageErrorFunction, funcAst.Name),
68-
funcAst.Extent, GetName(), DiagnosticSeverity.Strict, fileName));
68+
funcAst.Extent, GetName(), DiagnosticSeverity.Information, fileName));
6969
}
7070

7171
return AstVisitAction.Continue;

Rules/ReturnCorrectTypesForDSCFunctions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ item is TypeDefinitionAst
4949
foreach (Tuple<string, StatementAst> outputType in outputTypes)
5050
{
5151
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.ReturnCorrectTypesForSetTargetResourceFunctionsDSCError),
52-
outputType.Item2.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
52+
outputType.Item2.Extent, GetName(), DiagnosticSeverity.Information, fileName);
5353
}
5454
}
5555
else
@@ -73,7 +73,7 @@ item is TypeDefinitionAst
7373
else
7474
{
7575
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.ReturnCorrectTypesForGetTestTargetResourceFunctionsDSCResourceError,
76-
func.Name, returnTypes[func.Name], type), outputType.Item2.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
76+
func.Name, returnTypes[func.Name], type), outputType.Item2.Extent, GetName(), DiagnosticSeverity.Information, fileName);
7777
}
7878
}
7979
}
@@ -116,7 +116,7 @@ item is TypeDefinitionAst
116116
if (!String.Equals(funcAst.Name, "Set") && !Helper.Instance.AllCodePathReturns(funcAst))
117117
{
118118
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.NotAllCodePathReturnsDSCFunctionsError, funcAst.Name, dscClass.Name),
119-
funcAst.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
119+
funcAst.Extent, GetName(), DiagnosticSeverity.Information, fileName);
120120
}
121121

122122
if (String.Equals(funcAst.Name, "Set"))
@@ -127,7 +127,7 @@ item is TypeDefinitionAst
127127
if (ret.Pipeline != null)
128128
{
129129
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.ReturnCorrectTypesForSetFunctionsDSCError, dscClass.Name),
130-
funcAst.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
130+
funcAst.Extent, GetName(), DiagnosticSeverity.Information, fileName);
131131
}
132132
}
133133
}
@@ -143,7 +143,7 @@ item is TypeDefinitionAst
143143
{
144144
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.ReturnCorrectTypesForDSCFunctionsNoTypeError,
145145
funcAst.Name, dscClass.Name, returnTypes[funcAst.Name]),
146-
ret.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
146+
ret.Extent, GetName(), DiagnosticSeverity.Information, fileName);
147147
}
148148

149149
string typeName = Helper.Instance.GetTypeFromReturnStatementAst(funcAst, ret, classes);
@@ -161,7 +161,7 @@ item is TypeDefinitionAst
161161
{
162162
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.ReturnCorrectTypesForDSCFunctionsWrongTypeError,
163163
funcAst.Name, dscClass.Name, returnTypes[funcAst.Name], typeName),
164-
ret.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
164+
ret.Extent, GetName(), DiagnosticSeverity.Information, fileName);
165165
}
166166
}
167167
}

Rules/UseIdenticalMandatoryParametersDSC.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
8686
{
8787
List<string> functionsNotContainingParam = expectedTargetResourceFunctionNames.Except(mandatoryParameters[paramName]).ToList();
8888
yield return new DiagnosticRecord(string.Format(CultureInfo.InvariantCulture, Strings.UseIdenticalMandatoryParametersDSCError, paramName, string.Join(", ", functionsNotContainingParam.ToArray())),
89-
ast.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
89+
ast.Extent, GetName(), DiagnosticSeverity.Information, fileName);
9090
}
9191

9292
}

Rules/UseIdenticalParametersDSC.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
4848
if (funcParamAsts.Count() != funcParamAsts2.Count())
4949
{
5050
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UseIdenticalParametersDSCError),
51-
firstFunc.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
51+
firstFunc.Extent, GetName(), DiagnosticSeverity.Information, fileName);
5252
}
5353

5454
foreach (ParameterAst paramAst in funcParamAsts)
@@ -62,7 +62,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
6262
|| !CompareParamAsts(paramAst, paramNames[paramAst.Name.VariablePath.UserPath]))
6363
{
6464
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UseIdenticalParametersDSCError),
65-
paramAst.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
65+
paramAst.Extent, GetName(), DiagnosticSeverity.Information, fileName);
6666
}
6767
}
6868
}

Rules/UseStandardDSCFunctionsInResource.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
4949
if (!targetResourceFunctionNamesInAst.Contains(expectedTargetResourceFunctionName, StringComparer.CurrentCultureIgnoreCase))
5050
{
5151
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UseStandardDSCFunctionsInResourceError, expectedTargetResourceFunctionName),
52-
ast.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
52+
ast.Extent, GetName(), DiagnosticSeverity.Information, fileName);
5353
}
5454
}
5555
}
@@ -80,7 +80,7 @@ item is TypeDefinitionAst
8080
if (!functions.Any(function => String.Equals(resourceFunctionName, (function as FunctionMemberAst).Name)))
8181
{
8282
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UseStandardDSCFunctionsInClassError, resourceFunctionName),
83-
dscClass.Extent, GetName(), DiagnosticSeverity.Strict, fileName);
83+
dscClass.Extent, GetName(), DiagnosticSeverity.Information, fileName);
8484
}
8585
}
8686
}

0 commit comments

Comments
 (0)