From 1a33a90d1d16280fbe7aeac58efcb2039285242a Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Thu, 30 Dec 2021 09:57:57 +1000 Subject: [PATCH 1/3] Set CA1507 to Warning and fix instances of errors --- eng/CodeAnalysis.ruleset | 2 +- src/Shared/ToolsetElement.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/CodeAnalysis.ruleset b/eng/CodeAnalysis.ruleset index 2078c42fe6c..fec1f95ebf2 100644 --- a/eng/CodeAnalysis.ruleset +++ b/eng/CodeAnalysis.ruleset @@ -66,7 +66,7 @@ - + diff --git a/src/Shared/ToolsetElement.cs b/src/Shared/ToolsetElement.cs index f3f240f8537..de6e82da1c4 100644 --- a/src/Shared/ToolsetElement.cs +++ b/src/Shared/ToolsetElement.cs @@ -132,7 +132,7 @@ public string toolsVersion { get { - return (string)base["toolsVersion"]; + return (string)base[nameof(toolsVersion)]; } set @@ -738,7 +738,7 @@ public string DefaultOverrideToolsVersion // whenever the base class gives us an empty string. // Note this means we can't distinguish between the attribute being present but containing // an empty string for its value and the attribute not being present at all. - string defaultValue = (string)base["DefaultOverrideToolsVersion"]; + string defaultValue = (string)base[nameof(DefaultOverrideToolsVersion)]; return String.IsNullOrEmpty(defaultValue) ? null : defaultValue; } From 24f66c8d308c2969e299529beb12531f01cb132e Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Sat, 8 Jan 2022 09:46:12 +1000 Subject: [PATCH 2/3] Revert ruleset changes --- eng/CodeAnalysis.ruleset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/CodeAnalysis.ruleset b/eng/CodeAnalysis.ruleset index fec1f95ebf2..2078c42fe6c 100644 --- a/eng/CodeAnalysis.ruleset +++ b/eng/CodeAnalysis.ruleset @@ -66,7 +66,7 @@ - + From fac59372cd454d49cc6154a9172a5d78b697a7d7 Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Sat, 8 Jan 2022 09:47:52 +1000 Subject: [PATCH 3/3] Change CA1507 to warning --- eng/Common.globalconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Common.globalconfig b/eng/Common.globalconfig index fd878420d57..c296a5351de 100644 --- a/eng/Common.globalconfig +++ b/eng/Common.globalconfig @@ -200,7 +200,7 @@ dotnet_diagnostic.CA1505.severity = none dotnet_diagnostic.CA1506.severity = none # Use nameof to express symbol names -dotnet_diagnostic.CA1507.severity = suggestion +dotnet_diagnostic.CA1507.severity = warning # Avoid dead conditional code dotnet_diagnostic.CA1508.severity = none