From d2d0e1336cfc48f4b1a69fdea8f59e1afe135a84 Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Tue, 20 Sep 2022 13:46:01 +0100 Subject: [PATCH] Make messages of UseCorrectCasing more detailed --- Rules/Strings.Designer.cs | 83 ++++++++++++++++++++++----------------- Rules/Strings.resx | 5 ++- Rules/UseCorrectCasing.cs | 4 +- 3 files changed, 52 insertions(+), 40 deletions(-) diff --git a/Rules/Strings.Designer.cs b/Rules/Strings.Designer.cs index b94192697..30d0a7321 100644 --- a/Rules/Strings.Designer.cs +++ b/Rules/Strings.Designer.cs @@ -465,42 +465,6 @@ internal static string AvoidLongLinesName { } } - /// - /// Looks up a localized string similar to Avoid semicolons as line terminators. - /// - internal static string AvoidSemicolonsAsLineTerminatorsCommonName { - get { - return ResourceManager.GetString("AvoidSemicolonsAsLineTerminatorsCommonName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Line should not end with a semicolon. - /// - internal static string AvoidSemicolonsAsLineTerminatorsDescription { - get { - return ResourceManager.GetString("AvoidSemicolonsAsLineTerminatorsDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Line ends with a semicolon. - /// - internal static string AvoidSemicolonsAsLineTerminatorsError { - get { - return ResourceManager.GetString("AvoidSemicolonsAsLineTerminatorsError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to AvoidSemicolonsAsLineTerminators. - /// - internal static string AvoidSemicolonsAsLineTerminatorsName { - get { - return ResourceManager.GetString("AvoidSemicolonsAsLineTerminatorsName", resourceCulture); - } - } - /// /// Looks up a localized string similar to Avoid multiple type specifiers on parameters. /// @@ -609,6 +573,42 @@ internal static string AvoidOverwritingBuiltInCmdletsName { } } + /// + /// Looks up a localized string similar to Avoid semicolons as line terminators. + /// + internal static string AvoidSemicolonsAsLineTerminatorsCommonName { + get { + return ResourceManager.GetString("AvoidSemicolonsAsLineTerminatorsCommonName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Line should not end with a semicolon. + /// + internal static string AvoidSemicolonsAsLineTerminatorsDescription { + get { + return ResourceManager.GetString("AvoidSemicolonsAsLineTerminatorsDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Line ends with a semicolon. + /// + internal static string AvoidSemicolonsAsLineTerminatorsError { + get { + return ResourceManager.GetString("AvoidSemicolonsAsLineTerminatorsError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AvoidSemicolonsAsLineTerminators. + /// + internal static string AvoidSemicolonsAsLineTerminatorsName { + get { + return ResourceManager.GetString("AvoidSemicolonsAsLineTerminatorsName", resourceCulture); + } + } + /// /// Looks up a localized string similar to Avoid Using ShouldContinue Without Boolean Force Parameter. /// @@ -2644,7 +2644,7 @@ internal static string UseCorrectCasingDescription { } /// - /// Looks up a localized string similar to Cmdlet/Function/Parameter does not match its exact casing '{0}'.. + /// Looks up a localized string similar to Function/Cmdlet '{0}' does not match its exact casing '{1}'.. /// internal static string UseCorrectCasingError { get { @@ -2661,6 +2661,15 @@ internal static string UseCorrectCasingName { } } + /// + /// Looks up a localized string similar to Parameter '{0}' of function/cmdlet '{1}' does not match its exact casing '{2}'.. + /// + internal static string UseCorrectCasingParameterError { + get { + return ResourceManager.GetString("UseCorrectCasingParameterError", resourceCulture); + } + } + /// /// Looks up a localized string similar to Extra Variables. /// diff --git a/Rules/Strings.resx b/Rules/Strings.resx index 68eeeebe2..20b04712d 100644 --- a/Rules/Strings.resx +++ b/Rules/Strings.resx @@ -1099,7 +1099,7 @@ For better readability and consistency, use the exact casing of the cmdlet/function/parameter. - Cmdlet/Function/Parameter does not match its exact casing '{0}'. + Function/Cmdlet '{0}' does not match its exact casing '{1}'. UseCorrectCasing @@ -1188,4 +1188,7 @@ AvoidUsingBrokenHashAlgorithms + + Parameter '{0}' of function/cmdlet '{1}' does not match its exact casing '{2}'. + \ No newline at end of file diff --git a/Rules/UseCorrectCasing.cs b/Rules/UseCorrectCasing.cs index 9569b1904..9d3abd098 100644 --- a/Rules/UseCorrectCasing.cs +++ b/Rules/UseCorrectCasing.cs @@ -58,7 +58,7 @@ public override IEnumerable AnalyzeScript(Ast ast, string file if (!commandName.Equals(correctlyCasedCommandName, StringComparison.Ordinal)) { yield return new DiagnosticRecord( - string.Format(CultureInfo.CurrentCulture, Strings.UseCorrectCasingError, commandName, shortName), + string.Format(CultureInfo.CurrentCulture, Strings.UseCorrectCasingError, commandName, correctlyCasedCommandName), GetCommandExtent(commandAst), GetName(), DiagnosticSeverity.Warning, @@ -91,7 +91,7 @@ public override IEnumerable AnalyzeScript(Ast ast, string file if (!parameterName.Equals(correctlyCasedParameterName, StringComparison.Ordinal)) { yield return new DiagnosticRecord( - string.Format(CultureInfo.CurrentCulture, Strings.UseCorrectCasingError, commandName, parameterName), + string.Format(CultureInfo.CurrentCulture, Strings.UseCorrectCasingParameterError, parameterName, commandName, correctlyCasedParameterName), GetCommandExtent(commandAst), GetName(), DiagnosticSeverity.Warning,