Sample
pyint-d11e47ad8e3d-I02
Shorten method, parameter, and local names without collisions
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.891 | 0–1; higher is more readable |
| Mi | 0.469 | 0–1; higher is more readable |
| LLOC | 43 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14.67 | 0–20; mean of three runs |
| BTTF | 0.531 | 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.404 | −6.606 |
Intercept 8.87 + feature contributions = -26.051 (log-odds).
Score = sigmoid(-26.051) = 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.852 | +0.553 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.046 | +0.497 |
| 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.1 (log-odds).
Score = sigmoid(2.1) = 0.891.
| Score | 0.469 |
|---|
| Score | 43 |
|---|
Run 1
The code is generally readable but has notable issues. The function named 'con' is truncated and non-descriptive, hurting clarity of intent. Variable names like 'par', 'ctx2', and 'obj2' are slightly confusing and inconsistent with typical naming conventions. The method includes nested try/except blocks (up to three levels deep), which increases cognitive load. However, the overall structure is logical, imports are organized, and each line performs a single action. The docstring is helpful, and the code is concise for its purpose. Improvements could include renaming the method to 'convert', flattening nested exception handling, and using clearer parameter names.
Run 2
The code demonstrates generally good structure with clear class definition and logical organization. Function length is moderate, and the nested try-except blocks, while somewhat deep, handle distinct error cases appropriately. Intent is clear through descriptive naming and error messages. However, readability is slightly hindered by: inconsistent parameter naming (e.g., 'con' instead of 'convert', 'ctx2' instead of 'ctx', 'obj2' instead of 'obj'), which obscures meaning; multiple try-except blocks increasing nesting depth; and the final bare 'raise' without explicit context, which may confuse readers about what exception is being re-raised. The method name 'con' (likely abbreviated from 'convert') lacks clarity. Action granularity is adequate, with most operations on separate lines. Overall, the code is readable but would benefit from more explicit naming and slightly reduced nesting.
Run 3
Overall the code is fairly readable, but it has several issues. The class and method names are cryptic ('CertParamType', 'con', 'par', 'ctx2'), which weakens clarity of intent. The method body mixes multiple actions per line and has redundant try/except blocks. The type annotations are somewhat verbose and inconsistent (e.g., 'val: t.Any' but 'obj2' untyped). Nesting depth is moderate—several nested try/excepts and conditionals—but not overly tangled. The reading flow is natural for a Click parameter implementation, but the 'raise' at the end is ambiguous without surrounding context. Code length is reasonable, but action granularity could be improved by splitting lines that perform both parsing and reassignment. The lack of docstring on the method also reduces clarity.
Run 1
Code Structure: The certificate-handling logic is contained in a focused class, but numerous unrelated imports clutter the snippet. Nesting: Nested try/except blocks and conditionals make the conversion method moderately difficult to scan. Clarity of intent: The class docstring and descriptive error messages clearly explain supported inputs, while names such as con, par, ctx2, and obj2 obscure meaning; con also differs from Click's conventional convert method name. Code length: The implementation is reasonably concise, although the unused imports add unnecessary length. Action granularity: Statements generally perform one action per line, with multiline calls formatted cleanly. Reading flow: Validation proceeds logically from file paths to adhoc certificates to SSLContext imports, but handling fallback paths inside an exception block and ending with a bare raise require readers to track exception context.
Run 2
Code Structure: Imports, a documented parameter class, initialization, and conversion logic are logically organized. Nesting: Nested exception handling and the conditional certificate branch add moderate depth, but early returns keep it manageable. Clarity of intent: The docstring and informative error messages explain the supported inputs well; however, names such as con, val, par, ctx2, and obj2 obscure meaning, and the bare raise requires tracing the enclosing exception handler. Code length: The implementation is reasonably concise, although many imports are unused in the provided snippet. Action granularity: Statements generally perform one action per line, with readable formatting for longer calls. Reading flow: Processing moves naturally from SSL availability to file validation and alternative certificate forms, but exception-driven branching and sparse spacing between import groups slightly interrupt the flow.
Run 3
Code Structure: The class logically groups certificate parameter handling, although numerous unused imports clutter this snippet. Nesting: Nested exception handling and conditional checks add moderate complexity, particularly for the ad-hoc certificate branch. Clarity of intent: The docstring and descriptive error messages explain the purpose well, but names such as con, par, ctx2, and obj2 obscure meaning; con also differs from Click's expected convert method name. Code length: The implementation is reasonably concise, but the import section is disproportionately long. Action granularity: Statements generally perform one action per line, with readable multiline calls. Reading flow: Processing progresses naturally from file validation to ad-hoc certificates and SSLContext imports, but using exception handling for fallback and ending with a bare raise makes the flow slightly harder to follow.