rspec/rules/S2166/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
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.
2023-05-25 14:18:12 +02:00

38 lines
801 B
Plaintext

== Why is this an issue?
include::description.adoc[]
=== Noncompliant code example
[source,text]
----
public class FruitException { // Noncompliant; this has nothing to do with Exception
private Fruit expected;
private String unusualCharacteristics;
private boolean appropriateForCommercialExploitation;
// ...
}
public class CarException { // Noncompliant; the extends clause was forgotten?
public CarException(String message, Throwable cause) {
// ...
----
=== Compliant solution
[source,text]
----
public class FruitSport {
private Fruit expected;
private String unusualCharacteristics;
private boolean appropriateForCommercialExploitation;
// ...
}
public class CarException extends Exception {
public CarException(String message, Throwable cause) {
// ...
----