diff --git a/Rules/AvoidUnloadableModule.cs b/DeprecatedRules/AvoidUnloadableModule.cs similarity index 100% rename from Rules/AvoidUnloadableModule.cs rename to DeprecatedRules/AvoidUnloadableModule.cs diff --git a/Rules/AvoidUsingFilePaths.cs b/DeprecatedRules/AvoidUsingFilePaths.cs similarity index 100% rename from Rules/AvoidUsingFilePaths.cs rename to DeprecatedRules/AvoidUsingFilePaths.cs diff --git a/Engine/Generic/AvoidCmdletGeneric.cs b/Engine/Generic/AvoidCmdletGeneric.cs index b23d85679..7a54d7331 100644 --- a/Engine/Generic/AvoidCmdletGeneric.cs +++ b/Engine/Generic/AvoidCmdletGeneric.cs @@ -45,7 +45,7 @@ public IEnumerable AnalyzeScript(Ast ast, string fileName) if (cmdletNameAndAliases.Contains(cmdAst.GetCommandName(), StringComparer.OrdinalIgnoreCase)) { - yield return new DiagnosticRecord(GetError(fileName), cmdAst.Extent, GetName(), DiagnosticSeverity.Warning, fileName); + yield return new DiagnosticRecord(GetError(fileName), cmdAst.Extent, GetName(), GetDiagnosticSeverity(), fileName); } } } @@ -97,5 +97,11 @@ public IEnumerable AnalyzeScript(Ast ast, string fileName) /// /// public abstract RuleSeverity GetSeverity(); + + /// + /// DiagnosticSeverity: Returns the severity of the rule of type DiagnosticSeverity + /// + /// + public abstract DiagnosticSeverity GetDiagnosticSeverity(); } } diff --git a/Engine/Generic/AvoidParameterGeneric.cs b/Engine/Generic/AvoidParameterGeneric.cs index 2f108b07d..039994c1f 100644 --- a/Engine/Generic/AvoidParameterGeneric.cs +++ b/Engine/Generic/AvoidParameterGeneric.cs @@ -44,7 +44,7 @@ public IEnumerable AnalyzeScript(Ast ast, string fileName) { if (ParameterCondition(cmdAst, ceAst)) { - yield return new DiagnosticRecord(GetError(fileName, cmdAst), cmdAst.Extent, GetName(), DiagnosticSeverity.Warning, fileName, cmdAst.GetCommandName()); + yield return new DiagnosticRecord(GetError(fileName, cmdAst), cmdAst.Extent, GetName(), GetDiagnosticSeverity(), fileName, cmdAst.GetCommandName()); } } } @@ -102,6 +102,16 @@ public IEnumerable AnalyzeScript(Ast ast, string fileName) /// The source type of the rule. public abstract SourceType GetSourceType(); + /// + /// RuleSeverity: Returns the severity of the rule. + /// + /// public abstract RuleSeverity GetSeverity(); + + /// + /// DiagnosticSeverity: Returns the severity of the rule of type DiagnosticSeverity + /// + /// + public abstract DiagnosticSeverity GetDiagnosticSeverity(); } } diff --git a/Rules/AvoidUsingComputerNameHardcoded.cs b/Rules/AvoidUsingComputerNameHardcoded.cs index 95ec0a454..869a27f09 100644 --- a/Rules/AvoidUsingComputerNameHardcoded.cs +++ b/Rules/AvoidUsingComputerNameHardcoded.cs @@ -141,7 +141,7 @@ public override SourceType GetSourceType() } /// - /// GetSeverity: Retrieves the severity of the rule: error, warning of information. + /// GetSeverity: Retrieves the severity of the rule: error, warning or information. /// /// public override RuleSeverity GetSeverity() @@ -149,6 +149,15 @@ public override RuleSeverity GetSeverity() return RuleSeverity.Error; } + /// + /// DiagnosticSeverity: Retrieves the severity of the rule of type DiagnosticSeverity: error, warning or information. + /// + /// + public override DiagnosticSeverity GetDiagnosticSeverity() + { + return DiagnosticSeverity.Error; + } + /// /// GetSourceName: Retrieves the module/assembly name the rule is from. /// diff --git a/Rules/AvoidUsingConvertToSecureStringWithPlainText.cs b/Rules/AvoidUsingConvertToSecureStringWithPlainText.cs index 0105680c8..b7bafde15 100644 --- a/Rules/AvoidUsingConvertToSecureStringWithPlainText.cs +++ b/Rules/AvoidUsingConvertToSecureStringWithPlainText.cs @@ -108,7 +108,7 @@ public override SourceType GetSourceType() } /// - /// GetSeverity: Retrieves the severity of the rule: error, warning of information. + /// GetSeverity: Retrieves the severity of the rule: error, warning or information. /// /// public override RuleSeverity GetSeverity() @@ -116,6 +116,15 @@ public override RuleSeverity GetSeverity() return RuleSeverity.Error; } + /// + /// DiagnosticSeverity: Retrieves the severity of the rule of type DiagnosticSeverity: error, warning or information. + /// + /// + public override DiagnosticSeverity GetDiagnosticSeverity() + { + return DiagnosticSeverity.Error; + } + /// /// GetSourceName: Retrieves the module/assembly name the rule is from. /// diff --git a/Rules/AvoidUsingInvokeExpression.cs b/Rules/AvoidUsingInvokeExpression.cs index 597383495..c91fd2ad1 100644 --- a/Rules/AvoidUsingInvokeExpression.cs +++ b/Rules/AvoidUsingInvokeExpression.cs @@ -85,6 +85,15 @@ public override RuleSeverity GetSeverity() return RuleSeverity.Warning; } + /// + /// DiagnosticSeverity: Retrieves the severity of the rule of type DiagnosticSeverity: error, warning or information. + /// + /// + public override DiagnosticSeverity GetDiagnosticSeverity() + { + return DiagnosticSeverity.Warning; + } + /// /// Method: Retrieves the module/assembly name the rule is from. /// diff --git a/Rules/UseIdenticalParametersDSC.cs b/Rules/UseIdenticalParametersDSC.cs index 99b9fac5e..f7eb69453 100644 --- a/Rules/UseIdenticalParametersDSC.cs +++ b/Rules/UseIdenticalParametersDSC.cs @@ -53,7 +53,7 @@ public IEnumerable AnalyzeDSCResource(Ast ast, string fileName if (funcParamAsts.Count() != funcParamAsts2.Count()) { yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UseIdenticalParametersDSCError), - firstFunc.Extent, GetName(), DiagnosticSeverity.Information, fileName); + firstFunc.Extent, GetName(), DiagnosticSeverity.Error, fileName); } foreach (ParameterAst paramAst in funcParamAsts)