Skip to content

Commit

Permalink
CA1051: Do not declare visible instance fields
Browse files Browse the repository at this point in the history
# Conflicts:
#	.editorconfig
#	test/.editorconfig
  • Loading branch information
Evangelink committed Jul 19, 2022
1 parent cc00a3f commit 1e07b60
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ dotnet_diagnostic.CA1816.severity = warning # not default, increased severity to
# CA1018: Mark attributes with AttributeUsageAttribute
dotnet_diagnostic.CA1018.severity = warning # not default, increased severity to ensure it is applied

# CA1051: Do not declare visible instance fields
dotnet_diagnostic.CA1051.severity = warning # not default, increased severity to ensure it is applied

#### C# Coding Conventions ####

# var preferences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ public class DesignModeClient : IDesignModeClient
private readonly IEnvironment _platformEnvironment;
private readonly TestSessionMessageLogger _testSessionMessageLogger;
private readonly object _lockObject = new();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Part of the public API.")]
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Part of the public API.")]
[SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "Part of the public API")]
protected Action<Message>? onCustomTestHostLaunchAckReceived;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Part of the public API.")]
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Part of the public API.")]
[SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "Part of the public API")]
protected Action<Message>? onAttachDebuggerAckRecieved;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;

namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.ObjectModel;
Expand All @@ -10,6 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.ObjectModel;
/// It stores the all relevant information of the test run.
/// </summary>
[DataContract]
[SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "Part of the public API")]
public sealed class TestRunDetails
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions test/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ dotnet_diagnostic.IDE0060.severity = warning
# CA1018: Mark attributes with AttributeUsageAttribute
dotnet_diagnostic.CA1018.severity = warning

# CA1051: Do not declare visible instance fields
dotnet_diagnostic.CA1051.severity = silent # Disabled on tests as it does not matter

#### C# Coding Conventions ####

#### .NET Formatting Rules ####
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Microsoft.TestPlatform.TestUtilities;

public class TestableTestPluginCache : TestPluginCache
{
public Action? Action;
public Action? Action { get; set; }

public TestableTestPluginCache(List<string> extensionsPath)
{
Expand Down

0 comments on commit 1e07b60

Please sign in to comment.