Sample
pyint-988ca5c2221c-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.878 | 0–1; higher is more readable |
| Mi | 0.266 | 0–1; higher is more readable |
| LLOC | 37 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15.33 | 0–20; mean of three runs |
| BTTF | 0.466 | 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. | 1968.287 | −64.953 |
| Source linesThe number of non-empty source lines. | 86 | +34.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.714 | −7.071 |
Intercept 8.87 + feature contributions = -28.754 (log-odds).
Score = sigmoid(-28.754) = 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. | 87 | −2.044 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 63 | +1.442 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 85.888 | +0.791 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.041 | +0.542 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 78.023 | +0.454 |
| 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. | 78.954 | +0.321 |
Intercept 0.07 + feature contributions = 1.974 (log-odds).
Score = sigmoid(1.974) = 0.878.
| Score | 0.266 |
|---|
| Score | 37 |
|---|
Run 1
The code is generally well-structured and readable. It has clear imports, logical class definition, and good use of type hints. The constructor has a complex boolean assertion that is hard to parse due to mixed operators and unclear intent, which slightly hurts readability. The if/else for base_url is awkward—it uses a negative condition with an empty 'pass' branch, then handles the actual logic in an else branch, which is backwards from typical flow. Nesting is shallow and action granularity is mostly one action per line. The docstring is thorough and helpful. The logic for URL construction could be extracted for clarity. Overall, the code is maintainable with minor clarity issues in the assertion and conditional structure.
Run 2
The code is well-structured with clear separation of concerns, following a logical flow through class definition, documentation, and method implementation. Imports are organized by source. Nesting remains flat—the if/else logic in the constructor has only one level. Type annotations and docstrings clearly communicate intent. Functionality is grouped into appropriate methods, each handling a single action per line in most cases. The unusual `if not (base_url is None): pass else:` pattern is slightly awkward and reduces readability compared to a simple `if base_url is None:`. Additionally, the assertion condition is complex and could be simplified with intermediate variables. Overall, the code reads naturally despite these minor issues.
Run 3
The code has reasonable structure and docstrings, but suffers from significant readability issues. The assertion in __init__ is deeply convoluted, mixing boolean logic with string formatting, making the intent unclear. The conditional block 'if not (base_url is None): pass else: ...' is an anti-pattern that should be inverted to avoid unnecessary nesting and the empty pass branch. The base_url construction mixes URL parsing and string concatenation in a way that obscures the logic. Type hints and imports are generally good, and method granularity is acceptable, but the overall flow is disrupted by awkward conditionals and complex expressions. The docstring is helpful but the code itself requires careful reading to understand the URL-building logic. The negation-heavy checks and mixed boolean operations reduce clarity significantly.
Run 1
Code Structure: Imports, the class, and its methods are logically organized, with thorough documentation and type annotations. Nesting: Mostly shallow, but the empty if branch and surrounding else unnecessarily indent the main initialization logic. Clarity of intent: Descriptive names and docstrings explain environment construction well; however, the compound assertion and double-negative condition obscure otherwise straightforward validation and default handling. Code length: Generally appropriate, though the pass branch is redundant and the documentation is lengthy relative to the implementation. Action granularity: Statements generally perform one action each, with clearly separated configuration lookup, URL parsing, and initialization. Reading flow: The progression from configuration defaults to URL construction and superclass initialization is natural, but the assertion and inverted conditional interrupt it. Flask is referenced without a visible import, leaving its type context incomplete in this snippet.
Run 2
Code Structure: Imports, class documentation, initialization, and serialization are logically organized. Nesting: Generally shallow, but the empty if branch and else unnecessarily indent the main initialization logic. Clarity of intent: Descriptive names, type hints, and detailed docstrings explain the purpose; however, the compound assertion and double-negative condition obscure straightforward validation and default handling. Code length: Mostly proportionate to functionality, though the pass branch is redundant and documentation dominates this small class. Action granularity: Statements generally perform one action per line, with clear intermediate variables. Reading flow: Configuration lookup, URL construction, and superclass initialization follow a natural sequence, interrupted slightly by awkward conditional phrasing and the dense assertion.
Run 3
Code Structure: Imports, a documented class, and two focused methods provide logical organization. Nesting: Mostly shallow, although the empty if branch and its else unnecessarily indent the main setup logic. Clarity of intent: Descriptive names, type hints, and detailed documentation clarify environment construction; the compound assertion and negated None check require extra interpretation. Code length: Reasonably concise for its functionality, but the pass branch adds avoidable code. Action granularity: Statements generally perform one action per line, with multiline expressions formatted clearly. Reading flow: Configuration lookup, URL construction, and superclass initialization follow a natural sequence, though the assertion and redundant conditional interrupt that flow.