Sample
pyint-55d5054808f0-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.275 | 0–1; higher is more readable |
| Mi | 0.464 | 0–1; higher is more readable |
| LLOC | 36 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 12 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.581 | 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. | 1844.924 | −60.882 |
| Source linesThe number of non-empty source lines. | 127 | +50.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.513 | −6.769 |
Intercept 8.87 + feature contributions = -7.982 (log-odds).
Score = sigmoid(-7.982) = 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. | 128 | −3.496 |
| 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. | 140.984 | −2.306 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 140.977 | +1.47 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 126.845 | +1.363 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 47 | +0.889 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.031 | +0.643 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
Intercept 0.07 + feature contributions = -0.969 (log-odds).
Score = sigmoid(-0.969) = 0.275.
| Score | 0.464 |
|---|
| Score | 36 |
|---|
Run 1
The code has good documentation and type hints, but its structure suffers from unclear conditionals and repetitive setup. The `as_view` method uses inverted conditionals like `if not (cls.init_every_request)` instead of the clearer `if cls.init_every_request`. The `if not (cls.decorators): pass` block is especially confusing — an empty `pass` branch with work in the `else` is a backwards pattern that hurts readability. Nesting is moderate but the conditional branches make the flow disorganized. Clarity is further reduced by the two different `view` function definitions, which share many lines but are not factored out. Action granularity is mostly one action per line, and the final attribute assignments are linear, which helps. However, the odd conditionals, duplicated type-ignore comments, and the unnecessary `pass` branch lower the score. Overall, the code is maintainable by experienced developers but not as readable as it should be given the straightforward logic.
Run 2
The code is generally readable due to extensive docstrings, clear naming, and logical organization. The View class structure is straightforward, and type annotations aid comprehension. However, the as_view method exhibits asymmetric branching, using 'if not (condition)' with pass/else, which inverts readability. The else branch contains deeply nested logic within a closure and has a duplicated comment plus multiple type-ignore statements. The return current_app.ensure_sync(...) line is long and performs multiple actions, reducing action granularity. Minimal comments explain complex behavior, and the contrast between well-documented class attributes and dense method logic disrupts flow. While functional, the conditional logic and nesting could be simplified to improve readability.
Run 3
The code is generally well-structured with clear class-level documentation and logical organization. It uses type hints and separation of concerns effectively. However, readability is hindered by some awkward control flow: the 'if not cls.decorators: pass else:' pattern is unnecessarily convoluted, and the conditional branching in as_view creates two similar view functions. There are redundant type-ignore comments and duplicated return lines. Nesting is mostly flat, and intent is clear from docstrings, but the decorator handling could be simpler. Action granularity is acceptable, though some lines combine multiple operations. The reading flow is natural overall.
Run 1
Code Structure: Logically organized into configuration attributes, the dispatch interface, and view creation. Nesting: Mostly shallow, though conditional nested function definitions require some attention. Clarity of intent: Descriptive names, type annotations, and thorough documentation clearly explain behavior; dynamic function attributes and closures add complexity. Code length: Implementation is reasonably concise, but extensive documentation, duplicated dispatch calls, and an unnecessary pass branch increase length. Action granularity: Generally one action per line, with no compressed multi-statement lines; chained ensure_sync invocation is slightly denser. Reading flow: Natural progression from configuration to execution and metadata assignment, interrupted by inverted conditions, redundant parentheses, long type-ignore comments, and a duplicated suppression comment.
Run 2
Code Structure: Logically organized into configuration attributes, an abstract dispatch method, and a view factory. Nesting: Mostly shallow, although conditional nested function definitions add some complexity. Clarity of intent: Descriptive names, type annotations, and thorough documentation explain behavior well; dynamic function attributes and type-ignore comments introduce friction. Code length: Implementation is reasonably concise, but extensive documentation, duplicated dispatch calls, and a redundant conditional/pass block increase length. Action granularity: Statements generally perform one action per line, with readable multiline calls. Reading flow: Progresses naturally from configuration to view creation and metadata assignment, but negated conditions with unnecessary parentheses, the empty branch, and duplicated type-ignore annotations interrupt the flow.
Run 3
Code Structure: Well-organized class with documented configuration attributes and focused methods. Nesting: Generally shallow, though conditional nested view functions add some complexity. Clarity of intent: Descriptive names, type annotations, and extensive documentation clearly explain behavior; dynamic function attributes require closer reading. Code length: Implementation is reasonably concise, but lengthy documentation, duplicated dispatch calls, and a redundant pass branch add bulk. Action granularity: Most lines perform one clear action; chained ensure_sync invocation is slightly denser. Reading flow: Progresses naturally from configuration to dispatch and view creation, but negated conditions with unnecessary parentheses, the empty decorator branch, and repeated type-ignore comments interrupt the flow.