Skip to content
This repository was archived by the owner on Jul 12, 2022. It is now read-only.

Commit 1997a8c

Browse files
committed
Removed private field visibility rule
Removed the HasPrivateAccessorOnFieldNamesFormattingRule. It did a subset of the work that ExplicitVisibilityRule does.
1 parent 23b723f commit 1997a8c

File tree

6 files changed

+31
-128
lines changed

6 files changed

+31
-128
lines changed

src/Microsoft.DotNet.CodeFormatting.Tests/Microsoft.DotNet.CodeFormatting.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@
111111
<Compile Include="Rules\HasNewLineBeforeFirstUsingFormattingRuleTests.cs" />
112112
<Compile Include="Rules\HasNoNewLineAfterOpenBraceFormattingRuleTests.cs" />
113113
<Compile Include="Rules\HasNoNewLineBeforeEndBraceFormattingRuleTests.cs" />
114-
<Compile Include="Rules\HasPrivateAccessorOnFieldNamesFormattingRuleTests.cs" />
115114
<Compile Include="Rules\HasUnderScoreInPrivateFieldNamesFormattingRuleTests.cs" />
116115
<Compile Include="Rules\UsesXunitForTestsFormattingRuleTests.cs" />
117116
</ItemGroup>

src/Microsoft.DotNet.CodeFormatting.Tests/Rules/ExplicitVisibilityRuleTests.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,5 +236,35 @@ internal S(int p1, int p2) { }
236236

237237
Verify(text, expected, runFormatter: false);
238238
}
239+
240+
[Fact]
241+
public void TestPrivateFields()
242+
{
243+
var text = @"
244+
using System;
245+
class T
246+
{
247+
static int x;
248+
private static int y;
249+
// some trivia
250+
protected internal int z;
251+
// some trivia
252+
int k = 1, s = 2;
253+
// some trivia
254+
}";
255+
var expected = @"
256+
using System;
257+
internal class T
258+
{
259+
private static int x;
260+
private static int y;
261+
// some trivia
262+
protected internal int z;
263+
// some trivia
264+
private int k = 1, s = 2;
265+
// some trivia
266+
}";
267+
Verify(text, expected);
268+
}
239269
}
240270
}

src/Microsoft.DotNet.CodeFormatting.Tests/Rules/HasPrivateAccessorOnFieldNamesFormattingRuleTests.cs

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/Microsoft.DotNet.CodeFormatting/Microsoft.DotNet.CodeFormatting.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
<Compile Include="Rules\HasNoNewLineAfterOpenBraceFormattingRule.cs" />
9696
<Compile Include="Rules\HasNoNewLineBeforeEndBraceFormattingRule.cs" />
9797
<Compile Include="Rules\HasNoCustomCopyrightHeaderFormattingRule.cs" />
98-
<Compile Include="Rules\HasPrivateAccessorOnFieldNamesFormattingRule.cs" />
9998
<Compile Include="Rules\HasUnderScoreInPrivateFieldNamesFormattingRule.cs" />
10099
<Compile Include="Rules\HasUsingsOutsideOfNamespaceFormattingRule.cs" />
101100
<Compile Include="Rules\IsFormattedFormattingRule.cs" />

src/Microsoft.DotNet.CodeFormatting/Rules/ExplicitVisibilityRule.cs

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

1212
namespace Microsoft.DotNet.CodeFormatting.Rules
1313
{
14-
[RuleOrder(12)]
14+
[RuleOrder(9)]
1515
internal sealed class ExplicitVisibilityRule : IFormattingRule
1616
{
1717
private sealed class VisibilityRewriter : CSharpSyntaxRewriter

src/Microsoft.DotNet.CodeFormatting/Rules/HasPrivateAccessorOnFieldNamesFormattingRule.cs

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)