CQM-Namespacelet

Namespaces shall not contain too few classes and/or routines

Required inputs: IR, RFG

Any namespace that contains less than 3 classes and routines is a violation of this rule.

Motivation

A very small package/ namespace offers no or very little functionality. Thus the sense of the package/namespace seems questionable. However, since a superfluous package/namespace makes it more difficult to understand the overall system, it is better to distribute the functionality contained there to other packages.

This rule is based on the CQM Quality Indicator: Paketchen (p. 258-260).

Reference

Simon, Frank/ Seng, Olaf/ Mohaupt, Thomas (2006): Code-Quality-Management: Technische Qualität industrieller Softwaresysteme transparent und vergleichbar gemacht, 1st ed., Heidelberg, Germany: dpunkt.verlag GmbH.

Possible Messages

Key

Text

Severity

Disabled

namespace_not_enough_members

This namespace contains only {val} members, it should contain at least {min_number_of_members} members.

None

False

Options

allowed_namespaces

allowed_namespaces : set[str] = set()

Namespaces ignored by the rule.
 

count_routines

count_routines : bool = True

Count routines of namespace.
 

count_templates

count_templates : bool = True

Count template classes of namespace.
 

include_anonymous

include_anonymous : bool = False

Whether anonymous namespaces are to be analysed.
 

min_number_of_members

min_number_of_members : int | None = 3

Minimum number of classes or routines that must be defined in a namespace.