6.2.11.9. HalsteadMetrics

Halstead complexity metrics

Nested Rules

Metric-Halstead.DifferentOperands

Different Halstead Operands

Metric-Halstead.DifferentOperators

Different Halstead Operators

Metric-Halstead.Difficulty

Halstead Difficulty

Metric-Halstead.Effort

Halstead Effort

Metric-Halstead.Length

Halstead Length

Metric-Halstead.TotalOperands

Total Halstead Operands

Metric-Halstead.TotalOperators

Total Halstead Operators

Metric-Halstead.Vocabulary

Halstead Vocabulary

Metric-Halstead.VocabularyFrequency

Halstead Vocabulary Frequency

Metric-Halstead.Volume

Halstead Volume

Options

operator_blacklist

operator_blacklist : set[str] = set()

A set of tokens that are not to be treated as operators and thus will be ignored by the Halstead metrics.
If, for example, the tokens ) and } are added, the number of different operators in the function sum() seen here is reduced from 9 to 7.

int sum(int a, int b) { return a + b; }

For more information on what is considered an operator please refer to the documentation (Analysis Guide / Metrics / Halstead metrics).