rspec/rules/S2166/rule.adoc

38 lines
801 B
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
2020-06-30 12:48:07 +02:00
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) {
// ...
----
2020-06-30 12:48:07 +02:00