-
Notifications
You must be signed in to change notification settings - Fork 241
Fix S1144: Nested type constructor accessibility is wrong in the rule message #9108
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
Changes from all commits
e35794e
c381eb4
2b1dece
f485839
150483f
8b600c6
50364d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ public Gen() : base(1) | |
| Console.WriteLine(); | ||
| } | ||
|
|
||
| public Gen(int i) : this() // Noncompliant {{Remove the unused private constructor 'Gen'.}} | ||
| public Gen(int i) : this() // Noncompliant {{Remove unused constructor of private type 'Gen'.}} | ||
| { | ||
| Console.WriteLine(); | ||
| } | ||
|
|
@@ -410,6 +410,22 @@ public void M39() | |
| } | ||
| } | ||
|
|
||
| internal class MyClass | ||
| { | ||
| protected MyClass() // Compliant | ||
| { | ||
| var a = 1; | ||
| } | ||
| } | ||
|
Comment on lines
+413
to
+419
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good test! I actually meant one with a private constructor (should be Noncompliant with a slightly different message).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The message will be the same (the default) as the first DataRow in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are absolutely right, of course. Still a good case to test! |
||
|
|
||
| internal class MyClass2 | ||
| { | ||
| private MyClass2() // Noncompliant {{Remove the unused private constructor 'MyClass2'.}} | ||
| { | ||
| var a = 1; | ||
| } | ||
| } | ||
|
|
||
| public interface IPublicInterface { } | ||
| [Serializable] | ||
| public sealed class PublicClass : IPublicInterface | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation can be improved.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the test classes:
UnusedPrivateMemberTest.Constructors.csUnusedPrivateMemberTest.Fields.csUnusedPrivateMemberTest.Methods.csUnusedPrivateMemberTest.Properties.csUnusedPrivateMemberTest.Types.csare following this indentation, I don't like it either, but I like it even less refactoring all the above :D.
Given this context, are you ok with merging as is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are three options:
I'd go with 3, but if you think it's too much of a sore on the eye, sticking with 1 is also fine.