CQM-IncorrectNameLengthFile

The names of files shall not be too short or too long

Required inputs: RFG

Any file whose name does not have between 2 and 50 characters, is a violation.
The rule checks the filename without extensions.

Motivation

Designators of software artefacts must be expressive on the one hand and allow conclusions to be drawn about their purpose, but on the other hand they must still be legible and memorable. Artifact names chosen in this way increase the readability of the code and thus its maintainability. It is counterproductive with regard to naming,

  • if the length of the artefact name becomes too great, i.e. can only be read and perceived with increased effort, and
  • if the length of the artefact name is too small, i.e. hardly conveys any content and there is a great risk of having artifacts with the same name in the system (which may then cause an unconscious attribute overlap, for example).

This rule is based on the CQM Quality Indicator: falsche Namenslänge (p. 186-188).

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

name_to_long

The name of this file has {val} characters, it should have no more than {max_length}.

None

False

name_to_short

The name of this file has only {val} characters, it should have at least {min_length}.

None

False

Options

max_length

max_length : int | None = 50

Maximal allowed filename length.
 

min_length

min_length : int | None = 2

Minimal allowed length of a file name.