Sample

pyint-33bff5b9490a-SRC

Unmodified source class

Lines29

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7050–1; higher is more readable
Mi0.4950–1; higher is more readable
LLOC19Logical lines; fewer is more readable
DeepSeek V4 Pro130–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.740–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 compare(self, a, b): return a < b def clean(self, x): return len(x)

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.687−7.03

Intercept 8.87 + feature contributions = -10.409 (log-odds).
Score = sigmoid(-10.409) = 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.9+0.45
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.87 (log-odds).
Score = sigmoid(0.87) = 0.705.

Score0.495
Score19
Run 1

The code imports many modules that are not used within the provided snippet, which adds clutter and obscures the actual functionality. The class definition is short and follows a standard validator pattern, which is good, but the purpose is only clear if the reader knows the BaseValidator API. The message uses ngettext_lazy correctly for pluralization, but the string format is verbose. The nesting is minimal and each method contains a single action, which supports readability. Overall, the structure is logical but the unused imports and lack of surrounding context reduce clarity. The code is concise in length, but the presence of irrelevant imports makes it less readable than it could be. Action granularity is appropriate, and reading flow is natural once the validator pattern is understood.

Run 2

The code is moderately readable but relies heavily on inheritance from a base class not shown, making the logic incomplete without context. Structure is clear: imports are organized, class is focused, and methods are short with a single action per line. Nesting is flat and reading flow is natural. However, clarity of intent is reduced because 'BaseValidator', 'compare', and 'clean' are undefined in this snippet, so the purpose of each method is unclear. The code length is concise, but this brevity comes at the cost of missing context. 'compare' and 'clean' are small and specific, which helps, but 'clean' returning len(x) is not obvious without knowing how it's used in the parent class. Overall, the snippet is maintainable but only if the surrounding code is available; on its own, readability is limited.

Run 3

The code shows mostly clear structure with logical imports and a focused class definition. The validators are concise, using existing base classes and lazy translation patterns effectively. The mixin of pluralization logic (ngettext_lazy) slightly burdens readability, but this is idiomatic Django. Action granularity and reading flow are good overall, with one operation per method. Minor issues include ambiguity around undeclared imports like BaseValidator (assumed from Django core), which could confuse readers unfamiliar with Django's validator hierarchy. Additionally, the use of `_lazy_re_compile` and `MAX_URL_LENGTH` suggests context beyond this snippet, but these imports are not actually used in the visible code, which may reduce clarity. Nesting is minimal and the class is flat. Overall, the code is readable but depends on Django-specific prior knowledge.

Run 1

Code Structure: The validator is logically organized, with class metadata followed by two small methods, though BaseValidator is not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, validation messages, and method bodies clearly express minimum-length validation, but generic parameter names slightly reduce clarity. Code length: The implementation is concise, although numerous unused imports add clutter. Action granularity: Each method performs one simple action per line; the multiline message declaration is appropriately formatted. Reading flow: The sequence from imports to class configuration to behavior is natural, with consistent indentation and spacing.

Run 2

Code Structure: The validator class logically groups its message, error code, comparison, and length calculation, though numerous unused imports distract from the small implementation. Nesting: Methods are flat, with no nested control flow. Clarity of intent: The class name and message clearly communicate minimum-length validation; generic parameter names and an undefined BaseValidator slightly reduce standalone clarity. Code length: The implementation is concise, but the import block is unnecessarily long for this excerpt. Action granularity: Each statement performs a single action, and the multiline translation call is cleanly formatted. Reading flow: Class metadata followed by short methods creates a natural progression, although a blank line before the decorator would improve separation from imports.

Run 3

Code Structure: The validator is logically organized into class metadata and two small methods, although BaseValidator is not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, validation message, and method implementations clearly communicate minimum-length validation, though generic parameter names are less descriptive. Code length: The implementation is concise, but many imports are unused in this snippet and add clutter. Action granularity: Each statement performs one action; the multiline message formatting remains readable. Reading flow: Imports, class configuration, comparison, and length extraction form a natural progression.