All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.plugins.csharp.S3241.html Maven / Gradle / Ivy

There is a newer version: 10.2.0.105762
Show newest version

Why is this an issue?

Private methods are intended for use only within their scope. If these methods return values that are not utilized by any calling functions, it indicates that the return operation is unnecessary. Removing such returns can enhance both efficiency and code clarity.

Noncompliant code example

class SomeClass
{
     private int PrivateMethod() => 42;

     public void PublicMethod()
     {
          PrivateMethod(); // Noncompliant: the result of PrivateMethod is not used
     }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy