rspec/rules/S1153/java/rule.adoc

41 lines
739 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
Appending ``++String.valueOf()++`` to a ``++String++`` decreases the code readability.
The argument passed to ``++String.valueOf()++`` should be directly appended instead.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,java]
2021-04-28 16:49:39 +02:00
----
public void display(int i){
System.out.println("Output is " + String.valueOf(i)); // Noncompliant
}
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,java]
2021-04-28 16:49:39 +02:00
----
public void display(int i){
System.out.println("Output is " + i); // Compliant
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]