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

org.sonar.l10n.java.rules.squid.S1172.html Maven / Gradle / Ivy

The newest version!

Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

Noncompliant Code Example

void doSomething(int a, int b) {     // "b" is unused
  compute(a);
}

Compliant Solution

void doSomething(int a) { 
  compute(a);
}

Exceptions

Override and implementation methods are excluded, as are methods that are intended to be overridden.

@override
void doSomething(int a, int b) {     // no issue reported on b
  compute(a);
}

public void foo(String s) {
  // designed to be extended but noop in standard case
}

protected void bar(String s) {
  //open-closed principle
}

public void qix(String s) {
  throw new UnsupportedOperationException("This method should be implemented in subclasses");
}

See

  • MISRA C++:2008, 0-1-11
  • MISRA C:2012, 2.7




© 2015 - 2025 Weber Informatics LLC | Privacy Policy