rspec/rules/S3235/rule.adoc
2022-02-04 16:28:24 +00:00

42 lines
618 B
Plaintext

Redundant parentheses are simply wasted keystrokes, and should be removed.
== Noncompliant Code Example
[source,text]
----
[MyAttribute()] //Noncompliant
class MyClass
{
public int MyProperty { get; set; }
public static MyClass CreateNew(int propertyValue)
{
return new MyClass() //Noncompliant
{
MyProperty = propertyValue
};
}
}
----
== Compliant Solution
[source,text]
----
[MyAttribute]
class MyClass
{
public int MyProperty { get; set; }
public static MyClass CreateNew(int propertyValue)
{
return new MyClass
{
MyProperty = propertyValue
};
}
}
----