Skip to content

Commit 78265ad

Browse files
committed
Use Recommended analysis mode
1 parent c4087e3 commit 78265ad

File tree

6 files changed

+10
-35
lines changed

6 files changed

+10
-35
lines changed

.globalconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,5 +237,11 @@ dotnet_diagnostic.CA1824.severity = none
237237
# CA1062: Validate arguments of public methods
238238
dotnet_diagnostic.CA1062.severity = none
239239

240+
# CA1510: Use ArgumentNullException throw helper
241+
dotnet_diagnostic.CA1510.severity = none
242+
243+
# CA1863: Use 'CompositeFormat'
244+
dotnet_diagnostic.CA1863.severity = none
245+
240246

241247
# TODO: Use YAnalyzers for var vs explicit types.

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<UseArtifactsOutput>true</UseArtifactsOutput>
55
<ArtifactsPath>$(MSBuildThisFileDirectory)artifacts</ArtifactsPath>
6-
<AnalysisLevel>latest</AnalysisLevel>
6+
<AnalysisLevel>latest-Recommended</AnalysisLevel>
77
<LangVersion>preview</LangVersion>
88
<Nullable>enable</Nullable>
99
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>

src/YTest.MTP.XUnit2/Filter/FilterHelper.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,6 @@ internal static class FilterHelper
1515
private static readonly char[] s_specialCharacters = ['\\', '(', ')', '&', '|', '=', '!', '~'];
1616
private static readonly HashSet<char> s_specialCharactersSet = new(s_specialCharacters);
1717

18-
/// <summary>
19-
/// Escapes a set of special characters for filter (%, (, ), &amp;, |, =, !, ~) by replacing them with their escape sequences.
20-
/// </summary>
21-
/// <param name="str">The input string that contains the text to convert.</param>
22-
/// <returns>A string of characters with special characters converted to their escaped form.</returns>
23-
public static string Escape(string str)
24-
{
25-
if (str is null)
26-
{
27-
throw new ArgumentNullException(nameof(str));
28-
}
29-
30-
if (str.IndexOfAny(s_specialCharacters) < 0)
31-
{
32-
return str;
33-
}
34-
35-
var builder = new StringBuilder();
36-
for (int i = 0; i < str.Length; ++i)
37-
{
38-
var currentChar = str[i];
39-
if (s_specialCharactersSet.Contains(currentChar))
40-
{
41-
builder.Append(EscapeCharacter);
42-
}
43-
builder.Append(currentChar);
44-
}
45-
46-
return builder.ToString();
47-
}
48-
4918
/// <summary>
5019
/// Converts any escaped characters in the input filter string.
5120
/// </summary>

src/YTest.MTP.XUnit2/MTPFramework/Capabilities/BannerMessageOwnerCapability.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ internal sealed class BannerMessageOwnerCapability : IBannerMessageOwnerCapabili
2222
));
2323

2424
private static string GetAssemblyVersion(Assembly assembly)
25-
=> ((AssemblyInformationalVersionAttribute?)assembly.GetCustomAttribute(typeof(AssemblyInformationalVersionAttribute)))?.InformationalVersion ?? "<unknown>";
25+
=> assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "<unknown>";
2626
}

src/YTest.MTP.XUnit2/MTPFramework/RunSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace YTest.MTP.XUnit2;
88

99
// TODO: Look into NoAutoReporters and ReporterSwitch to see if they can be supported.
10-
internal class RunSettings
10+
internal sealed class RunSettings
1111
{
1212
public AppDomainSupport? AppDomain { get; set; }
1313
// public int? AssertEquivalentMaxDepth { get; set; }

src/YTest.MTP.XUnit2/MTPFramework/XUnit2MTPCommandLineProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace YTest.MTP.XUnit2;
88

9-
internal class XUnit2MTPCommandLineProvider : ICommandLineOptionsProvider
9+
internal sealed class XUnit2MTPCommandLineProvider : ICommandLineOptionsProvider
1010
{
1111
public const string FilterOptionName = "filter";
1212
public const string SettingsOptionName = "settings";

0 commit comments

Comments
 (0)