CQM-DeadFields¶
A private filed of a class is not used
Required inputs: IR
Motivation
A class is used to implement an abstract data type, i.e. to provide services based on data internal to the class. If data is now declared internally, but not required for the provision of services, it is superfluous and only increases the system size.
The considered visibility is limited to private,
because only in this case a later
(external) use can be ruled out with high probability.
This rule is based on the CQM Quality Indicator: tote Attribute (p. 291-293).
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 |
|---|---|---|---|
unused_field |
Unused field |
None |
False |
Options¶
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
include_initialized¶
include_initialized : bool = True
only_private_fields¶
only_private_fields : bool = True
suppress_attribute_maybe_unused¶
suppress_attribute_maybe_unused : FilterAction = 'suppress'
[[maybe_unused]] or __attribute__((unused)).
If set to "suppress", findings will be reported but marked as suppressed.
If set to "exclude", findings will not be reported at all.
If set to "normal", no special treatment is applied and the finding is reported as usual.
Option Types¶
These types are used by options listed above:
FilterAction¶
Used for the return value of add_filter() callbacks.normal
The violation proceeds as usual.exclude
The violation is excluded: The violation is discarded as if `--exclude` applied to it. The following filters won't get to see the violation, and it will not be imported into the database under any circumstances.suppress
The violation is suppressed as if `AXIVION DISABLE` applied to it. Whether the violation gets imported into the database is controlled by the Axivion CI configuration.