Sample

pyint-4f0fbc1e6fdd-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines29

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7040–1; higher is more readable
Mi0.4930–1; higher is more readable
LLOC19Logical lines; fewer is more readable
DeepSeek V4 Pro3.330–20; mean of three runs
GPT-6.1 Sol14.330–20; mean of three runs
BTTF0.630–1; higher is more readable

Views

Source code

import ipaddress import math import re from pathlib import Path from urllib.parse import urlsplit from django.core.exceptions import ValidationError from django.utils.deconstruct import deconstructible from django.utils.http import MAX_URL_LENGTH from django.utils.ipv6 import is_valid_ipv6_address from django.utils.regex_helper import _lazy_re_compile from django.utils.translation import gettext_lazy as _ from django.utils.translation import ngettext_lazy @deconstructible class MinLengthValidator(BaseValidator): message = ngettext_lazy( "Ensure this value has at least %(limit_value)d character (it has " "%(show_value)d).", "Ensure this value has at least %(limit_value)d characters (it has " "%(show_value)d).", "limit_value", ) code = "min_length" def com(self, a2, b2): return a2 < b2 def cle(self, x2): return len(x2)

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(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.715−7.072

Intercept 8.87 + feature contributions = -10.45 (log-odds).
Score = sigmoid(-10.45) = 0.

Feature contributions

FeatureValueContribution
(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.522
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.967+0.448
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.909−0.006

Intercept 0.07 + feature contributions = 0.867 (log-odds).
Score = sigmoid(0.867) = 0.704.

Score0.493
Score19
Run 1

The code starts with reasonable imports but the class definition is severely incomplete and confusing. It inherits from BaseValidator without importing or defining it, references undeclared message and code attributes, and contains cryptic method names (com, cle) with meaningless parameters (a2, b2, x2) that obscure any intent. The logic appears to be a broken fragment of a validator with no clear structure or purpose. Action granularity is unclear because the methods do trivial operations but are named opaquely. Nesting is flat but reading flow is disorganized due to missing context and unexplained abbreviations. The code fails to convey what it validates, how it integrates with Django, or why these methods exist. Overall, it reads like an incomplete or obfuscated snippet rather than maintainable code.

Run 2

The code begins with reasonable imports and a Django validator subclass, but readability collapses due to unclear structure and naming. The class inherits from an undefined BaseValidator, creating ambiguity. Methods 'com' and 'cle' are cryptically named, obscuring their purpose—comparing two values and returning length, respectively. This violates clarity of intent and breaks reading flow. Action granularity is acceptable (one action per line), but nesting and structure suffer from incomplete implementation. Code length is short, yet this brevity does not aid readability due to missing context. The abrupt end after two methods leaves the class incomplete, further hindering comprehension. Overall, the code is disjointed, ambiguous, and difficult to interpret, despite starting with familiar imports and class declaration.

Run 3

The code is largely unreadable due to several factors. It has a disorganized structure, mixing unrelated imports with a partial class definition. The class MinLengthValidator attempts to inherit from BaseValidator, which is not imported, leading to a broken reference. The method names 'com' and 'cle' are ambiguous and provide no clarity of intent; they appear to be truncated or obfuscated. The code lacks proper action granularity and has poor reading flow, as it jumps from imports to an incomplete class with no logical progression. Nesting is flat but this does not compensate for the overall confusion. The code is concise, but at the cost of clarity and maintainability. Overall, it fails to meet most readability criteria.

Run 1

Code Structure: The validator class logically groups its message, error code, comparison, and length calculation, but unrelated imports add clutter and BaseValidator is not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name and validation message clearly convey minimum-length validation, while abbreviated method names (com, cle) and generic parameters (a2, b2, x2) obscure their roles. Code length: The implementation is concise, though many imports are unused in the shown code. Action granularity: Each statement performs a single action, and the multiline message declaration is neatly formatted. Reading flow: Imports, class metadata, and methods appear in a natural order, but clearer method and parameter names would improve comprehension.

Run 2

Code Structure: The validator class is logically organized, with configuration followed by small methods, but unused imports and the undefined BaseValidator obscure context. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, validation message, and error code clearly communicate minimum-length validation, but abbreviated method names (com, cle) and generic parameters (a2, b2, x2) conceal their roles. Code length: The implementation is concise, although the many unused imports add unnecessary clutter. Action granularity: Each method performs one simple action, and statements are cleanly separated. Reading flow: Configuration-to-method ordering is natural, and multiline message formatting is readable, but the unexplained dependency and cryptic identifiers interrupt comprehension.

Run 3

Code Structure: The validator class is logically organized, with message metadata followed by small methods, but numerous unused imports add clutter and BaseValidator is not defined or imported in the snippet. Nesting: Very shallow, making the code easy to scan. Clarity of intent: The class name, validation message, and error code clearly indicate minimum-length validation, but abbreviated method names (com, cle) and generic parameters (a2, b2, x2) obscure their roles. Code length: The implementation is concise, though the import list is disproportionate to the functionality shown. Action granularity: Each method performs a single operation, and statements are clearly separated. Reading flow: The class reads naturally from configuration to behavior, but unrelated imports and unclear identifiers interrupt comprehension.