Sample
pyint-f6d71645da2d-I11
Split eligible integer literals into pairs of short-named intermediate variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.741 | 0–1; higher is more readable |
| Mi | 0.306 | 0–1; higher is more readable |
| LLOC | 41 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 13.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.442 | 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. | 2169.371 | −71.589 |
| Source linesThe number of non-empty source lines. | 101 | +40.4 |
| 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.579 | −6.868 |
Intercept 8.87 + feature contributions = -29.188 (log-odds).
Score = sigmoid(-29.188) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 102 | −2.575 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 54 | +1.131 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 100.854 | +1 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 87.961 | +0.615 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.049 | +0.469 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| 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. | 87.892 | −0.058 |
Intercept 0.07 + feature contributions = 1.049 (log-odds).
Score = sigmoid(1.049) = 0.741.
| Score | 0.306 |
|---|
| Score | 41 |
|---|
Run 1
The code is generally well-structured and readable, with clear docstrings and a logical organization. It uses type hints and follows a consistent style. However, the `_prepare_response_obj` method contains confusing magic numbers (a=2, b=-1, c=1, d=-1) that obscure the intent of simple length checks and indexing. This reduces clarity and maintainability. Some minor duplication exists in the dumps/loads methods, but the design is standard for an abstract base class. Overall, the code is above average in readability but could be improved by simplifying the arithmetic expressions and adding a comment explaining the branching logic.
Run 2
The code is generally structured and well-documented, but it suffers from several readability issues that significantly detract from its clarity. The most glaring problem is the `_prepare_response_obj` method, where variables like `a`, `b`, `c`, and `d` hold obscure numeric values, making the logic of returning the single argument nearly impossible to understand without mental arithmetic. This is a major violation of 'Clarity of Intent'. Additionally, the method's logic (checking for args/kwargs, returning None, etc.) could be more simply expressed. While the rest of the code follows good practices like type hinting, docstrings, and flat structure, this one method's poor variable naming and convoluted conditional logic severely hinder the overall readability. The code is not unreadable as a whole, but this critical section drags down its score.
Run 3
The code is highly readable overall. It follows a clear, logical structure with a cohesive class definition and well-documented methods. Docstrings clearly explain purpose, parameters, and behavior. Nesting is minimal; the `_prepare_response_obj` method has a few conditionals but remains easy to follow. Intent is unambiguous, supported by type hints and descriptive naming. Length is reasonable for a base class with multiple responsibilities. Action granularity is mostly one action per line, keeping code digestible. Reading flow is natural, with methods arranged logically. A minor readability issue is the opaque variable naming (`a`, `b`, `c`, `d`) and arithmetic in `_prepare_response_obj`, which obscures intent compared to the rest of the code. Shortening that logic would improve clarity.
Run 1
Code Structure: Methods are logically organized around serialization, deserialization, and response creation, with a useful helper separating argument handling. Nesting: Shallow conditionals and early returns keep control flow simple. Clarity of intent: Descriptive method names, type annotations, and thorough docstrings explain most behavior well. However, meaningless variables a, b, c, and d obscure simple checks that should read len(args) == 1 and args[0]. Code length: Implementations are concise overall, although extensive documentation and unnecessary arithmetic assignments increase reading effort. Action granularity: Each statement performs one clear action, with no crowded multi-statement lines. Reading flow: The progression from basic JSON operations to response construction is natural, but the arithmetic indirection interrupts it. App and Response annotations lack visible definitions or imports, and several imports appear unused in this excerpt, adding minor distractions.
Run 2
Code Structure: Methods are logically grouped in a cohesive JSON provider class, with shared response preparation extracted into a helper. Nesting: Flat control flow and early returns make execution easy to follow. Clarity of intent: Descriptive method names, type annotations, and docstrings clearly explain most behavior, but arbitrary variables a, b, c, and d obscure simple length and index checks. App and Response are not defined or imported in the snippet, slightly reducing self-contained clarity. Code length: Implementations are concise overall, although unnecessary arithmetic assignments add noise and documentation dominates the snippet. Action granularity: Each statement generally performs one action, with compact expressions remaining understandable. Reading flow: Serialization, deserialization, and response methods appear in a natural order, but the arithmetic detour interrupts the helper's otherwise straightforward flow. Several unused imports also create minor distraction.
Run 3
Code Structure: Methods are logically organized within a cohesive JSON provider class, with shared response preparation extracted into a helper. Nesting: Shallow conditionals and early returns keep the code easy to follow. Clarity of intent: Descriptive method names, type hints, and thorough docstrings explain most behavior, but arbitrary variables a, b, c, and d obscure simple length and indexing operations. App and Response lack visible definitions or imports. Code length: Implementation methods are concise, although extensive documentation and unnecessary arithmetic assignments increase reading effort. Action granularity: Each line generally performs one clear action. Reading flow: Serialization, deserialization, and response handling follow a natural progression, interrupted mainly by the artificial arithmetic in _prepare_response_obj and unused imports.