One function

HalsteadClassifier in terryyin/lizard

The author described this change as fix(halstead): classify leading-dot float literals as operands in C-family code. It counts as a record because the check below fails on the code as it stood at 12ae6f853 and passes on 4ba7373a2, with nothing else changed between the two runs.

Fix saved2026-07-02
Sharing licenceMIT · LICENSE.txt
Change size+2 1

What the code was meant to do, written into the code itself as a docstring

Classify tokens into Halstead operators and operands. This is the per-language extension point. The base class implements the generic rules that work for the operators and punctuation shared by lizard's common tokenizer, plus a broad set of C-family keywords. Subclass it and override :attr:`keyword_operators` / :attr:`literal_keywords` (or :meth:`classify` itself) for language-specific behaviour.

The change

3737 if not token or token.isspace():
3838 return self.SKIP
3939 first = token[0]
40- if first in "\"'" or first.isdigit():
40+ if first in "\"'" or first.isdigit() or \
41+ (first == "." and token[1:2].isdigit()):
4142 # A string or numeric literal: lizard emits each quoted run or
4243 # number (or number fragment) as a single token.
4344 return self.OPERAND

The check that tells the two apart

failpass·test/testHalstead.py::TestHalsteadClassifierUnit::test_leading_dot_float_is_operand

Check file test/testHalstead.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it12ae6f853b5d0bba08ec4d29463a4ed3dd008d43
Broken version dated2026-06-30
Modulelizard_ext.lizardhalstead
Units changedHalsteadClassifier
Fingerprintd26a5ef16e7a066c
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in terryyin/lizard