rspec/rules/S3235/rule.adoc

44 lines
646 B
Plaintext
Raw Normal View History

== Why is this an issue?
2020-06-30 12:48:39 +02:00
Redundant parentheses are simply wasted keystrokes, and should be removed.
=== Noncompliant code example
2020-06-30 12:48:39 +02:00
2022-02-04 17:28:24 +01:00
[source,text]
2020-06-30 12:48:39 +02:00
----
[MyAttribute()] //Noncompliant
class MyClass
{
public int MyProperty { get; set; }
public static MyClass CreateNew(int propertyValue)
{
return new MyClass() //Noncompliant
{
MyProperty = propertyValue
};
}
}
----
=== Compliant solution
2020-06-30 12:48:39 +02:00
2022-02-04 17:28:24 +01:00
[source,text]
2020-06-30 12:48:39 +02:00
----
[MyAttribute]
class MyClass
{
public int MyProperty { get; set; }
public static MyClass CreateNew(int propertyValue)
{
return new MyClass
{
MyProperty = propertyValue
};
}
}
----