Skip to content

Commit 95216ee

Browse files
committed
Update
1 parent e8bd45c commit 95216ee

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

src/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,3 +852,6 @@ dotnet_diagnostic.S3923.severity = error
852852

853853
# S4158: Empty collections should not be accessed or iterated
854854
dotnet_diagnostic.S4158.severity = error
855+
856+
# S2696: Instance members should not write to "static" fields
857+
dotnet_diagnostic.S2696.severity = error

src/Tests/CodeAnalysisTest/OrganizeMembersTest.cs

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ namespace CodeAnalysisTest;
33
/// <summary>
44
/// Organize members test case
55
/// </summary>
6-
public class OrganizeMembersTest : IExplicit, IImplicit
6+
public class OrganizeMembersTest : IExplicit, IImplicit, IPropInterface
77
{
88
private bool _boolProp;
99
public bool BoolProp
1010
{
1111
get => _boolProp;
12-
set => _boolProp = value;
12+
set => _boolProp = value && false;
1313
}
1414

1515
/// <summary>
@@ -25,7 +25,7 @@ public bool BoolProp
2525
public string StrProp
2626
{
2727
get => _strProp;
28-
set => _strProp = value;
28+
set => _strProp = value + "";
2929
}
3030

3131
/// <summary>
@@ -49,6 +49,9 @@ public OrganizeMembersTest(bool boolProp, string strProp, int myField)
4949
_field2 = 0;
5050

5151
PublicMehtod();
52+
53+
InterfaceProp = string.Empty;
54+
InterfaceProp2 = string.Empty;
5255
}
5356

5457
// Field3
@@ -118,6 +121,12 @@ Task IImplicit.TaskMethodAsync(CancellationToken cancellationToken)
118121

119122
throw new NotImplementedException();
120123
}
124+
125+
/// <inheritdoc/>
126+
public string InterfaceProp { get; set; }
127+
128+
/// <inheritdoc/>
129+
public string InterfaceProp2 { get; set; }
121130
}
122131

123132
/// <summary>
@@ -142,4 +151,26 @@ public interface IImplicit
142151
/// </summary>
143152
/// <returns></returns>
144153
public Task TaskMethodAsync(CancellationToken cancellationToken);
154+
155+
/// <summary>
156+
/// Interface has method and property.
157+
/// </summary>
158+
/// <value>
159+
/// The interface property.
160+
/// </value>
161+
public string InterfaceProp2 { get; set; }
162+
}
163+
164+
/// <summary>
165+
/// Prop Interface
166+
/// </summary>
167+
public interface IPropInterface
168+
{
169+
/// <summary>
170+
/// Gets or sets the interface property.
171+
/// </summary>
172+
/// <value>
173+
/// The interface property.
174+
/// </value>
175+
public string InterfaceProp { get; set; }
145176
}

0 commit comments

Comments
 (0)