
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
42 lines
555 B
Plaintext
42 lines
555 B
Plaintext
== Why is this an issue?
|
|
|
|
include::description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,text]
|
|
----
|
|
class A {
|
|
private int x;
|
|
private int y;
|
|
|
|
public void setX(int val) { // Noncompliant: field 'x' is not updated
|
|
this.y = val;
|
|
}
|
|
|
|
public int getY() { // Noncompliant: field 'y' is not used in the return value
|
|
return this.x;
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,text]
|
|
----
|
|
class A {
|
|
private int x;
|
|
private int y;
|
|
|
|
public void setX(int val) {
|
|
this.x = val;
|
|
}
|
|
|
|
public int getY() {
|
|
return this.y;
|
|
}
|
|
}
|
|
----
|
|
|