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

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

There is a newer version: 9.30.0.95878
Show newest version

Why is this an issue?

Putting multiple statements on a single line lowers the code readability and makes debugging the code more complex.

if (someCondition) DoSomething(); // Noncompliant

Write one statement per line to improve readability.

if (someCondition)
{
  DoSomething();
}

Exceptions

The rule ignores:

  • block statements
  • anonymous functions containing a single statement
Func<object, bool> item1 = o => { return true; }; // Compliant by exception
Func<object, bool> item1 = o => { var r = false; return r; }; // Noncompliant

Resources

Documentation





© 2015 - 2024 Weber Informatics LLC | Privacy Policy