Sample
pyint-2b6eb0ac6862-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.891 | 0–1; higher is more readable |
| Mi | 0.398 | 0–1; higher is more readable |
| LLOC | 43 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.67 | 0–20; mean of three runs |
| BTTF | 0.535 | 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. | 1694.374 | −55.914 |
| Source linesThe number of non-empty source lines. | 69 | +27.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.394 | −6.59 |
Intercept 8.87 + feature contributions = -26.035 (log-odds).
Score = sigmoid(-26.035) = 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. | 70 | −1.442 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 63 | +1.442 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.971 | +0.599 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 68.864 | +0.553 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.045 | +0.502 |
| 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. | 86.929 | −0.017 |
Intercept 0.07 + feature contributions = 2.104 (log-odds).
Score = sigmoid(2.104) = 0.891.
| Score | 0.398 |
|---|
| Score | 43 |
|---|
Run 1
The code is generally readable with clear imports, type hints, and logical organization. The CertParamType class has a focused purpose and the convert method follows a coherent flow. However, there are some issues: the nested try/except blocks create moderate complexity, and the final raise statement without context could be confusing - it re-raises the original BadParameter exception from the path_type call, which isn't immediately obvious. The import ssl inside the method could be at module level for clarity. Type ignores and conditional imports add minor noise. Variable naming is clear, and line lengths are reasonable. Overall structure is good but the error handling flow could be more explicit, and the exception re-raise pattern requires careful reading to understand.
Run 2
The code is generally readable and well-structured. Each class and method has a clear responsibility, and the import section is organized. Nesting is moderate; the nested try/except blocks are logically necessary but make the flow slightly harder to follow at a glance. The action granularity is good, with one logical action per line in most cases. Reading flow is natural, especially due to descriptive error messages. The main deductions come from the repeated pattern of raising click.BadParameter inside nested try/except blocks, which could be simplified or extracted for clarity. Some lines, like the type-ignore comment and multi-part return/raise, add slight noise. Overall, the code is concise and understandable for a developer familiar with Click and Flask.
Run 3
The code is well-structured and readable. It uses clear class and method naming, type hints, and a logical progression of operations within the `convert` method. Each action is generally on its own line, and nesting is moderate (mostly within conditionals and try-except blocks). The purpose of handling different certificate types is evident, and error messages are descriptive. The main source of minor complexity is the nested try-except for the ad-hoc certificate case, which adds some depth but is still understandable. Overall, the code is concise, intention-revealing, and follows common Python patterns.
Run 1
Code Structure: Imports, a documented parameter class, and focused methods provide logical organization. Nesting: The conversion method has moderately nested exception handling and conditional branches, but remains manageable. Clarity of intent: The docstring, descriptive names, type annotations, and explicit error messages clearly explain supported certificate inputs. Code length: The implementation is concise for its validation responsibilities, although the many imports unrelated to this excerpt add visual overhead. Action granularity: Statements generally perform one action each, with no compressed multi-statement lines. Reading flow: Validation proceeds naturally from SSL availability to file paths, ad-hoc certificates, and imported SSL contexts. However, the fallback logic inside an exception handler and the final bare raise require readers to track the original exception, slightly weakening readability.
Run 2
Code Structure: The class cleanly encapsulates certificate-option parsing, separating initialization from conversion, although the long import block adds clutter. Nesting: Several nested try/except and conditional blocks make the fallback path moderately difficult to follow. Clarity of intent: The docstring, descriptive names, type annotations, and specific error messages clearly explain supported inputs and requirements. Code length: The implementation is reasonably concise, but many imports are unused in this snippet. Action granularity: Statements generally perform one action per line, with readable multiline calls. Reading flow: Processing naturally progresses from SSL availability to file validation, then ad-hoc certificates and imported SSL contexts. However, placing all alternative handling inside an exception block and ending with a bare raise requires readers to track exception context.
Run 3
Code Structure: The class cleanly separates initialization from conversion, although many imports are unused in this excerpt. Nesting: Moderate nesting in exception handling and the ad-hoc certificate branch adds some complexity. Clarity of intent: The docstring, descriptive names, type annotations, and actionable error messages clearly explain supported inputs. Code length: The implementation is reasonably concise, but the large import block distracts from the small class. Action granularity: Statements generally perform one action per line, with readable multiline calls. Reading flow: Conversion follows a logical progression from SSL availability to file paths, ad-hoc certificates, and imported SSL contexts. However, using an exception handler for fallback dispatch and ending with a bare raise require readers to track exception context.