Skip to content
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

Merged
merged 6 commits into from Mar 2, 2023

Conversation

zsolt-kolbay-sonarsource
Copy link
Contributor

Copy link
Contributor

@antonioaversa antonioaversa left a 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.

@@ -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.
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@sonarsource-next
Copy link

SonarQube Quality Gate for 'rspec-tools'

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sonarsource-next
Copy link

SonarQube Quality Gate for 'rspec-frontend'

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

rules/S3398/csharp/rule.adoc Outdated Show resolved Hide resolved
rules/S3398/csharp/rule.adoc Outdated Show resolved Hide resolved
rules/S3398/csharp/rule.adoc Outdated Show resolved Hide resolved
rules/S3398/java/rule.adoc Outdated Show resolved Hide resolved
rules/S3398/rule.adoc Outdated Show resolved Hide resolved
@sonarsource-next
Copy link

SonarQube Quality Gate for 'rspec-tools'

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sonarsource-next
Copy link

SonarQube Quality Gate for 'rspec-frontend'

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Contributor

@andrei-epure-sonarsource andrei-epure-sonarsource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants