Inheritance is certainly one of the most valuable concepts in object-oriented programming. It's a way to compartmentalize and reuse code by creating collections of attributes and behaviors called classes which can be based on previously created classes. But abusing this concept by creating a deep inheritance tree can lead to very complex and unmaintainable source code. Most of the time too deep of an inheritance tree is due to bad object oriented design which leads to a systematic use of 'inheritance' when 'composition' would be better suited.


This rule raises an issue when the inheritance tree, starting from ``++Object++`` has a greater depth than is allowed. 


For the parameter of the rule, the following rules are applied:


* ``++?++`` matches a single character
* ``++*++`` matches zero or more characters
* ``++**++`` matches zero or more packages

Examples:

* ``++java.fwk.AbstractFwkClass++`` will stop count when AbstractFwkClassclass is reached.
* ``++java.fwk.*++`` will stop count when any member of java.fwkPackage package is reached.
* ``++java.fwk.**++`` same as above, but including sub-packages.

Exceptions:

The rule stops counting when it encounters a class from one of the following packages (or sub-packages):

* ``++android.**++``
* ``++com.intellij.**++``
* ``++com.persistit.**++``
* ``++javax.swing.**++``
* ``++org.eclipse.**++``
* ``++org.springframework.**++``
ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

include::../parameters.adoc[]

include::../highlighting.adoc[]

endif::env-github,rspecator-view[]
