Sample

pyint-f470e7f395d4-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines20

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5860–1; higher is more readable
Mi0.3490–1; higher is more readable
LLOC15Logical lines; fewer is more readable
DeepSeek V4 Pro180–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.6830–1; higher is more readable

Views

Source code

from django.apps import AppConfig from django.contrib.contenttypes.checks import ( check_generic_foreign_keys, check_model_name_lengths, ) from django.core import checks from django.db.models.signals import post_migrate, pre_migrate from django.utils.translation import gettext_lazy as _ from .management import create_contenttypes, inject_rename_contenttypes_operations class ContentTypesConfig(AppConfig): default_auto_field = "django.db.models.AutoField" name = "django.contrib.contenttypes" verbose_name = _("Content Types") def ready(self): pre_migrate.connect(inject_rename_contenttypes_operations, sender=self) post_migrate.connect(create_contenttypes) checks.register(check_generic_foreign_keys, checks.Tags.models) checks.register(check_model_name_lengths, checks.Tags.models)

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.659.022−21.748
Source linesThe number of non-empty source lines.20+8
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.59−6.885

Intercept 8.87 + feature contributions = -11.763 (log-odds).
Score = sigmoid(-11.763) = 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
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.058+0.376
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.21+0.293
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.82+0.192
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.19.783−0.133
Indentation frequencyHow rapidly indentation changes from line to line.20−0.045

Intercept 0.07 + feature contributions = 0.346 (log-odds).
Score = sigmoid(0.346) = 0.586.

Score0.349
Score15
Run 1

The code is highly readable with clear logical organization, minimal nesting, and natural flow. It imports necessary components in a grouped manner, defines a Django AppConfig subclass with clear configuration attributes, and implements the ready() method with one action per line. Each line expresses a distinct intent: connecting signals and registering checks. The code is concise without unnecessary verbosity, and the method names are descriptive enough to convey purpose without comments. The only minor deductions are for potential ambiguity in the sender=self argument and checks.Tags usage for those unfamiliar with Django internals, but this is standard Django boilerplate and remains clear to its target audience.

Run 2

The code is highly readable. It follows Django conventions with clear imports, a single-purpose AppConfig subclass, and a concise ready() method. Structure is logical: imports are grouped and organized, class attributes are straightforward, and method action granularity is clean—each signal connection or check registration is on its own line. Nesting is minimal, and the reading flow is natural, from setup to signal wiring. The use of a custom management import preserves clarity without hiding intent. The only minor deduction is that the ready() method could benefit from a brief comment explaining the two signals' purposes for developers unfamiliar with Django's content types framework.

Run 3

The code is highly readable, following Django conventions and clean organization. Imports are logically grouped (AppConfig, content type checks, signals, translation). The class structure is straightforward, with clear attributes and a single ready() method. Each action within ready() is on its own line, maintaining one-action-per-line granularity. Nesting is minimal, with no deeply nested blocks, and the reading flow is natural—properties first, then method logic. The purpose is unambiguous: registering content type signals and checks. The code is concise without sacrificing clarity, though a brief comment explaining 'ready' could slightly improve intent for newcomers.

Run 1

Code Structure: Imports, application metadata, and startup registrations are logically organized. Nesting: Only the class and method levels are present, with no nested control flow. Clarity of intent: Descriptive names make the migration hooks and model checks understandable, though Django lifecycle knowledge is needed to fully interpret ready(). Code length: Compact, with no unnecessary logic or repetition. Action granularity: Each assignment and registration occupies its own line. Reading flow: The code proceeds naturally from dependencies to configuration and initialization. Minor spacing improvements between import groups and before the class would improve visual separation.

Run 2

Code Structure: Imports, application metadata, and initialization logic are logically organized. Nesting: Minimal nesting, limited to a class and its method. Clarity of intent: Descriptive names clearly convey signal connections and model-check registration, though understanding ready() requires Django familiarity. Code length: Concise, with no unnecessary logic or repetition. Action granularity: Each statement performs a single configuration or registration action. Reading flow: Natural progression from dependencies to configuration to startup behavior. A blank line separating absolute and relative imports, and another before the class, would slightly improve visual organization.

Run 3

Code Structure: Imports, application metadata, and initialization logic are logically organized. Nesting: Minimal nesting, limited to a class and its method. Clarity of intent: Descriptive names clearly communicate signal connections and check registration, though understanding ready() requires Django familiarity. Code length: Concise, with no unnecessary logic or repetition. Action granularity: Each statement performs one distinct configuration action. Reading flow: Natural progression from dependencies to configuration to initialization. Minor spacing improvements, such as separating third-party and relative imports and adding another blank line before the class, would improve visual organization.