Sample
pyint-d478c752d313-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.706 | 0–1; higher is more readable |
| Mi | 0.496 | 0–1; higher is more readable |
| LLOC | 19 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 5.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 12.33 | 0–20; mean of three runs |
| BTTF | 0.64 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 722.67 | −23.848 |
| Source linesThe number of non-empty source lines. | 29 | +11.6 |
| Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value. | 4.703 | −7.055 |
Intercept 8.87 + feature contributions = -10.433 (log-odds).
Score = sigmoid(-10.433) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.043 | +0.527 |
| Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names. | 75.933 | +0.449 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 29 | +0.266 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 30 | −0.026 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 28.896 | −0.006 |
Intercept 0.07 + feature contributions = 0.874 (log-odds).
Score = sigmoid(0.874) = 0.706.
| Score | 0.496 |
|---|
| Score | 19 |
|---|
Run 1
The code presents a mix of clean imports and an incomplete class definition. The MinLengthValidator class correctly uses Django conventions (message, code) and logical structure in its first part, but the methods 'sendKey' and 'close' lack clear intent: names are unrelated to validation, parameters are misleading (key/age, map), and logic is unclear. This breaks 'Clarity of intent' and 'Code structure' significantly. Nesting is flat and action granularity is acceptable, but the code appears truncated or heavily edited. The reading flow is disrupted by unexplained method names and logic that don't connect to the validator's purpose. Additionally, the class relies on an undefined 'BaseValidator', making the code non-functional as shown. This drastically reduces practical readability. While the import block and initial class setup are standard, the overall snippet scores low due to confusing method design and missing essential context.
Run 2
The code is nearly unreadable due to severe structural issues. The class MinLengthValidator inherits from BaseValidator, but BaseValidator is never imported, creating broken code. The validator methods `sendKey` and `close` have cryptic names unrelated to their actions — `sendKey` compares values and `close` returns a length. This makes intent completely unclear. The class defines validation metadata (message, code) but no `__call__` or `compare` method, so it does not function as a validator. The nesting is flat, but only because the code is sparse and disjointed. Action granularity is okay (one action per line), yet reading flow suffers from random method names and missing context. Numerous unused imports (ipaddress, math, re, urlsplit, etc.) add noise without purpose. Overall, the snippet appears to be malformed or partially obfuscated, with minimal redeeming readability qualities aside from clean indentation.
Run 3
The code begins with a clean, organized set of imports and a properly decorated class, but it deteriorates rapidly. The MinLengthValidator class lacks the BaseValidator import and is incomplete. The methods sendKey and close are poorly named, with vague purposes and misleading parameter names like 'key', 'age', and 'map'. The return statements compare unrelated concepts (key < age) and return len(map) without context. The class has no clear relationship between its methods and the validator's intended purpose. While the import structure demonstrates good organization, the class implementation shows confusion between what appears to be dictionary/key-value operations and the validation logic. The code structure is flat, which is positive, but the action granularity and clarity of intent are poor. The reading flow is disrupted by these semantically disconnected methods.
Run 1
Code Structure: Imports and a small validator class are logically organized, but unused imports add clutter and BaseValidator is not defined or imported in the snippet. Nesting: Very shallow, with simple method bodies. Clarity of intent: The class name, message, and error code clearly indicate minimum-length validation, but sendKey and close obscure the methods’ apparent comparison and length-calculation purposes. Parameters key, age, and map are misleading, and map shadows a built-in. Code length: The class is concise, although the extensive unused imports are unnecessary. Action granularity: Each method performs one straightforward action per line; the multiline message remains readable. Reading flow: The overall top-to-bottom flow is natural, but inconsistent method naming and the mismatch between validator intent and method names interrupt comprehension.
Run 2
Code Structure: Imports, decorator, class attributes, and methods are logically organized, but numerous unused imports and the undefined BaseValidator reduce self-contained readability. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: MinLengthValidator, its message, and its error code suggest length validation, but sendKey(key, age) and close(map) obscure the comparison and length-calculation roles; map also shadows a built-in. Code length: The implementation is short, although unused imports add unnecessary clutter. Action granularity: Each statement performs one clear operation, and the multiline translation call is readable. Reading flow: Conventional class layout supports natural reading, but inconsistent method naming and misleading parameter names interrupt understanding.
Run 3
Code Structure: Imports and a validator class are logically separated, but numerous unused imports and the undefined BaseValidator obscure context. Nesting: Very shallow, with simple method bodies. Clarity of intent: The class name, message, and error code clearly indicate minimum-length validation, but sendKey, close, key, age, and map poorly describe their roles and conflict with that purpose. Code length: The implementation is short, though unused imports add unnecessary clutter. Action granularity: Each executable line performs one action; the multiline message declaration remains coherent. Reading flow: The progression from imports to class metadata to methods is natural, but the unexpected method names interrupt comprehension and require readers to infer how validation works.