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
S3398: Add C# description #1572
S3398: Add C# description #1572
Conversation
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.
LGTM, just a non-blocking remark on the use of the word inner
.
rules/S3398/description.adoc
Outdated
@@ -0,0 +1 @@ | |||
When a ``++private++`` method is only invoked by an inner class, there's no reason not to move it into that class. It will still have the same access to the outer class' members, but the outer class will be clearer and less cluttered. |
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.
Up to you actually, but I would not use the word inner class
, but nested class
.
Nested is the standard way "types within types" are defined (c.p. https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/nested-types).
While calling them nested or inner doesn't make any difference in C#, it does in Java (where the rule was first implemented), where inner classes have a reference to the outer class this
and nested classes (which are called static class
) don't.
The example in the Java code shows that they actually meant inner, since Outie.this.increment();
is used. So using nested
in C# would in my opinion avoid some confusion.
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.
Couldn't agree more. Renamed it.
SonarQube Quality Gate for 'rspec-tools' |
SonarQube Quality Gate for 'rspec-frontend' |
SonarQube Quality Gate for 'rspec-tools' |
SonarQube Quality Gate for 'rspec-frontend' |
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.
LGTM
SonarSource/sonar-dotnet#6706