Skip to content

Halstead ​

Unique Operators ​

halstead.unique_operators — n1.

ItemValue
DefinitionNumber of distinct operators.
Scopefunction, file, project
InputTokens (kind and text)
CalculationOperators: keyword and operator tokens and opening brackets ( [ {. Operands: identifier and literal tokens. Commas, semicolons, closing brackets and comments are not counted. Distinct = same token text.
Unitcount
Language Applicabilitypartially_language_dependent
LimitationsKeywords, including type keywords such as int, are operators. A string literal is one operand.
ReferenceHalstead, M. H. (1977). Elements of Software Science. Elsevier.

Unique Operands ​

halstead.unique_operands — n2.

ItemValue
DefinitionNumber of distinct operands.
Scopefunction, file, project
InputTokens (kind and text)
CalculationOperators: keyword and operator tokens and opening brackets ( [ {. Operands: identifier and literal tokens. Commas, semicolons, closing brackets and comments are not counted. Distinct = same token text.
Unitcount
Language Applicabilitypartially_language_dependent
LimitationsKeywords, including type keywords such as int, are operators. A string literal is one operand.
ReferenceHalstead, M. H. (1977). Elements of Software Science. Elsevier.

Total Operators ​

halstead.total_operators — N1.

ItemValue
DefinitionNumber of operator occurrences.
Scopefunction, file, project
InputTokens (kind and text)
CalculationOperators: keyword and operator tokens and opening brackets ( [ {. Operands: identifier and literal tokens. Commas, semicolons, closing brackets and comments are not counted. Distinct = same token text.
Unitcount
Language Applicabilitypartially_language_dependent
LimitationsKeywords, including type keywords such as int, are operators. A string literal is one operand.
ReferenceHalstead, M. H. (1977). Elements of Software Science. Elsevier.

Total Operands ​

halstead.total_operands — N2.

ItemValue
DefinitionNumber of operand occurrences.
Scopefunction, file, project
InputTokens (kind and text)
CalculationOperators: keyword and operator tokens and opening brackets ( [ {. Operands: identifier and literal tokens. Commas, semicolons, closing brackets and comments are not counted. Distinct = same token text.
Unitcount
Language Applicabilitypartially_language_dependent
LimitationsKeywords, including type keywords such as int, are operators. A string literal is one operand.
ReferenceHalstead, M. H. (1977). Elements of Software Science. Elsevier.

Vocabulary ​

halstead.vocabulary — n.

ItemValue
Definitionn = n1 + n2.
Scopefunction, file, project
InputTokens (kind and text)
CalculationOperators: keyword and operator tokens and opening brackets ( [ {. Operands: identifier and literal tokens. Commas, semicolons, closing brackets and comments are not counted. Distinct = same token text.
Unitcount
Language Applicabilitypartially_language_dependent
LimitationsKeywords, including type keywords such as int, are operators. A string literal is one operand.
ReferenceHalstead, M. H. (1977). Elements of Software Science. Elsevier.

Program Length ​

halstead.length — N.

ItemValue
DefinitionN = N1 + N2.
Scopefunction, file, project
InputTokens (kind and text)
CalculationOperators: keyword and operator tokens and opening brackets ( [ {. Operands: identifier and literal tokens. Commas, semicolons, closing brackets and comments are not counted. Distinct = same token text.
Unitcount
Language Applicabilitypartially_language_dependent
LimitationsKeywords, including type keywords such as int, are operators. A string literal is one operand.
ReferenceHalstead, M. H. (1977). Elements of Software Science. Elsevier.

Volume ​

halstead.volume — V.

ItemValue
DefinitionV = N * log2(n); not_applicable when n = 0.
Scopefunction, file, project
InputTokens (kind and text)
CalculationOperators: keyword and operator tokens and opening brackets ( [ {. Operands: identifier and literal tokens. Commas, semicolons, closing brackets and comments are not counted. Distinct = same token text.
Unitbits
Language Applicabilitypartially_language_dependent
LimitationsKeywords, including type keywords such as int, are operators. A string literal is one operand.
ReferenceHalstead, M. H. (1977). Elements of Software Science. Elsevier.

Difficulty ​

halstead.difficulty — D.

ItemValue
DefinitionD = (n1 / 2) * (N2 / n2); not_applicable when n2 = 0.
Scopefunction, file, project
InputTokens (kind and text)
CalculationOperators: keyword and operator tokens and opening brackets ( [ {. Operands: identifier and literal tokens. Commas, semicolons, closing brackets and comments are not counted. Distinct = same token text.
Unitratio
Language Applicabilitypartially_language_dependent
LimitationsKeywords, including type keywords such as int, are operators. A string literal is one operand.
ReferenceHalstead, M. H. (1977). Elements of Software Science. Elsevier.

Effort ​

halstead.effort — E.

ItemValue
DefinitionE = D * V.
Scopefunction, file, project
InputTokens (kind and text)
CalculationOperators: keyword and operator tokens and opening brackets ( [ {. Operands: identifier and literal tokens. Commas, semicolons, closing brackets and comments are not counted. Distinct = same token text.
Unitcount
Language Applicabilitypartially_language_dependent
LimitationsKeywords, including type keywords such as int, are operators. A string literal is one operand.
ReferenceHalstead, M. H. (1977). Elements of Software Science. Elsevier.

Estimated Program Time ​

halstead.time — T.

ItemValue
DefinitionT = E / 18.
Scopefunction, file, project
InputTokens (kind and text)
CalculationOperators: keyword and operator tokens and opening brackets ( [ {. Operands: identifier and literal tokens. Commas, semicolons, closing brackets and comments are not counted. Distinct = same token text.
Unitseconds
Language Applicabilitypartially_language_dependent
LimitationsKeywords, including type keywords such as int, are operators. A string literal is one operand.
ReferenceHalstead, M. H. (1977). Elements of Software Science. Elsevier.

Estimated Bugs ​

halstead.bugs — B.

ItemValue
DefinitionB = V / 3000.
Scopefunction, file, project
InputTokens (kind and text)
CalculationOperators: keyword and operator tokens and opening brackets ( [ {. Operands: identifier and literal tokens. Commas, semicolons, closing brackets and comments are not counted. Distinct = same token text.
Unitcount
Language Applicabilitypartially_language_dependent
LimitationsKeywords, including type keywords such as int, are operators. A string literal is one operand.
ReferenceHalstead, M. H. (1977). Elements of Software Science. Elsevier.