Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove some redundant qualifiers #4435

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ internal static string TrimStackTrace(string stackTrace)
/// <returns>
/// The aggregated exception message that considers inner exceptions.
/// </returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
internal static string GetFormattedExceptionMessage(this Exception ex)
{
DebugEx.Assert(ex != null, "exception should not be null.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal static class DataSerializationHelper
{
UseSimpleDictionaryFormat = true,
EmitTypeInformation = System.Runtime.Serialization.EmitTypeInformation.Always,
DateTimeFormat = new System.Runtime.Serialization.DateTimeFormat("O", System.Globalization.CultureInfo.InvariantCulture),
DateTimeFormat = new System.Runtime.Serialization.DateTimeFormat("O", CultureInfo.InvariantCulture),
};

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/MSTest.TestAdapter/Helpers/FixtureKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Helpers;

[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items should be documented", Justification = "Internal and self-explanatory")]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items should be documented", Justification = "Internal and self-explanatory")]
internal enum FixtureKind
{
AssemblyInitialize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class MSTestDiscoverer : ITestDiscoverer
/// <param name="logger">Logger used to log messages.</param>
/// <param name="discoverySink">Used to send testcases and discovery related events back to Discoverer manager.</param>
[System.Security.SecurityCritical]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Justification = "Discovery context can be null.")]
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Justification = "Discovery context can be null.")]
public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink) => MSTestDiscoverer.DiscoverTests(sources, discoveryContext, logger, discoverySink, null);

internal static void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink, IConfiguration? configuration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ private void WindowsRuntimeMetadataReflectionOnlyNamespaceResolve(object sender,
/// <param name="args"> The args. </param>
/// <param name="isReflectionOnly"> Indicates whether this is called under a Reflection Only Load context. </param>
/// <returns> The <see cref="Assembly"/>. </returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "senderAppDomain", Justification = "This is an event handler.")]
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "senderAppDomain", Justification = "This is an event handler.")]
#pragma warning disable IDE0060 // Remove unused parameter
private Assembly? OnResolveInternal(object? senderAppDomain, ResolveEventArgs args, bool isReflectionOnly)
#pragma warning restore IDE0060 // Remove unused parameter
Expand Down Expand Up @@ -686,8 +686,8 @@ private static void SafeLog(string? assemblyName, Action loggerAction)
/// <param name="requestedName"> The requested Name. </param>
/// <param name="isReflectionOnly"> Indicates whether this is called under a Reflection Only Load context. </param>
/// <returns> The <see cref="Assembly"/>. </returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.Reflection.Assembly.LoadFrom", Justification = "The assembly location is figured out from the configuration that the user passes in.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
[SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.Reflection.Assembly.LoadFrom", Justification = "The assembly location is figured out from the configuration that the user passes in.")]
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
private Assembly? SearchAndLoadAssembly(string assemblyPath, string assemblyName, AssemblyName requestedName, bool isReflectionOnly)
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public AssemblyLoadWorker()
/// <param name="assemblyPath"> Path to the assembly file to load from. </param>
/// <param name="warnings"> The warnings. </param>
/// <returns> Full path to dependent assemblies. </returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
public IReadOnlyCollection<string> GetFullPathToDependentAssemblies(string assemblyPath, out IList<string> warnings)
{
DebugEx.Assert(!StringEx.IsNullOrEmpty(assemblyPath), "assemblyPath");
Expand Down Expand Up @@ -217,7 +217,7 @@ private void ProcessChildren(Assembly assembly, IList<string> result, ISet<strin
/// <param name="result"> The result. </param>
/// <param name="visitedAssemblies"> The visited Assemblies. </param>
/// <param name="warnings"> The warnings. </param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
private void GetDependentAssembliesInternal(string assemblyString, IList<string> result, ISet<string> visitedAssemblies, IList<string> warnings)
{
DebugEx.Assert(!StringEx.IsNullOrEmpty(assemblyString), "assemblyString");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private static bool ExecuteWithThreadPool(Action action, int timeout, Cancellati
}
#endif

[System.Runtime.Versioning.SupportedOSPlatform("windows")]
[SupportedOSPlatform("windows")]
private static bool ExecuteWithCustomThread(Action action, int timeout, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected override void AddDependenciesOfDeploymentItem(string deploymentItemFil
}

#if NETFRAMEWORK
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")]
public void ProcessNewStorage(string testSource, IList<DeploymentItem> deploymentItems, IList<string> warnings)
{
// Add deployment items and process .config files only for storages we have not processed before.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static class VSInstallationUtilities
/// Gets the visual studio installation path on the local machine.
/// </summary>
/// <returns>VS install path.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Need to ignore failures to read the registry settings")]
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Need to ignore failures to read the registry settings")]
public static string? VSInstallPath
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static (Dictionary<string, string?> SingleValueData, Dictionary<string, s
private (Dictionary<string, string?> SingleValueData, Dictionary<string, string?> PropertyToAllChildren) ParseStream(Stream input)
{
using StreamReader reader = new(input);
var doc = (JsonObject)Jsonite.Json.Deserialize(reader.ReadToEnd(), _settings);
var doc = (JsonObject)Json.Deserialize(reader.ReadToEnd(), _settings);
if (doc is not null)
{
VisitObjectElement(doc);
Expand Down Expand Up @@ -64,7 +64,7 @@ private void SavePropertyToAllChildren(object? property)
throw new FormatException(string.Format(CultureInfo.InvariantCulture, PlatformResources.JsonConfigurationFileParserDuplicateKeyErrorMessage, key));
}

_propertyToAllChildren[key] = Jsonite.Json.Serialize(property, _settings);
_propertyToAllChildren[key] = Json.Serialize(property, _settings);
}

private void VisitArrayElement(JsonArray array)
Expand Down Expand Up @@ -114,7 +114,7 @@ private void VisitValue(object? value)
// Adapt to the System.Text.Json serialization outcome
_singleValueData[key] = value is bool boolean
? CultureInfo.InvariantCulture.TextInfo.ToTitleCase(boolean.ToString())
: value is string stringValue ? stringValue.Trim('\"') : Jsonite.Json.Serialize(value, _settings);
: value is string stringValue ? stringValue.Trim('\"') : Json.Serialize(value, _settings);

break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal static bool IsWindows

internal static (bool AcceptAnsiColorCodes, bool OutputIsScreen, uint? OriginalConsoleMode) QueryIsScreenAndTryEnableAnsiColorCodes(StreamHandleType handleType = StreamHandleType.StdOut)
{
if (System.Console.IsOutputRedirected)
if (Console.IsOutputRedirected)
{
// There's no ANSI terminal support if console output is redirected.
return (AcceptAnsiColorCodes: false, OutputIsScreen: false, OriginalConsoleMode: null);
Expand Down
Loading
Loading