Sample
pyint-a49982357b74-I02
Shorten method, parameter, and local names without collisions
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.574 | 0–1; higher is more readable |
| Mi | 0.474 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs |
| BTTF | 0.67 | 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. | 909.931 | −30.028 |
| Source linesThe number of non-empty source lines. | 24 | +9.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.554 | −6.831 |
Intercept 8.87 + feature contributions = -18.389 (log-odds).
Score = sigmoid(-18.389) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.06 | +0.357 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 25 | +0.151 |
| 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. | 83.92 | +0.111 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 24 | +0.093 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 23.918 | −0.076 |
Intercept 0.07 + feature contributions = 0.3 (log-odds).
Score = sigmoid(0.3) = 0.574.
| Score | 0.474 |
|---|
| Score | 17 |
|---|
Run 1
The code is generally readable with clear imports and a simple class structure. The PermissionManager class is concise, and the method get2 has a clear purpose but suffers from poorly chosen, cryptic parameter names (cod, app, mod) and an ambiguous method name (get2). The method body is relatively flat and readable, but the nested call to content_type makes the line slightly harder to follow. While the code is short and well-organized, the unclear naming reduces its overall clarity and intent.
Run 2
The code demonstrates strong readability through logical structure with clear separation of imports, consistent naming conventions, and a well-organized class definition. Nesting is minimal with only one level in the get2 method. Intent is clear through descriptive method and parameter names. The code is concise and avoids unnecessary verbosity. Each line performs a single logical action, maintaining good granularity. Reading flow is natural, with imports grouped by type and the class method structured cleanly. Minor deduction for the ambiguous method name 'get2' and slightly unclear parameter names 'cod', 'app', 'mod' which could be more descriptive, but overall the code is highly professional and maintainable.
Run 3
The code is short and mostly readable but has several issues. Imports appear excessive for the snippet's scope, suggesting unused dependencies. The class method 'get2' has a vague name that doesn't convey its purpose, violating clarity of intent. The nested call inside get() (ContentType.objects.db_manager(self.db).get_by_natural_key) creates unnecessary depth and reduces reading flow. The parameter names 'cod', 'app', and 'mod' are ambiguous abbreviations that hurt readability. Action granularity is generally good with one operation per statement, but the multi-line nested method call interrupts natural reading flow. The file lacks docstrings or comments explaining the custom PermissionManager's purpose, making intent unclear. Import ordering follows conventions, but many imports seem irrelevant to this snippet. Overall, the code is functional but could be clearer with better naming, reduced nesting, and purposeful documentation.
Run 1
Code Structure: Imports and a small manager class are logically organized, though most imports are unused in this snippet. Nesting: Shallow nesting makes the code easy to follow; the nested content-type lookup adds only modest complexity. Clarity of intent: The query clearly retrieves a permission using its codename and content type, but get2 and the abbreviated parameters cod, app, and mod obscure the method's purpose. Code length: The method is concise, while the extensive unused imports create unnecessary visual overhead. Action granularity: The return expression combines content-type resolution and permission retrieval, but multiline formatting keeps these operations distinguishable. Reading flow: The flow is generally natural and readable, although more descriptive names and a blank line between imports and the class would improve it.
Run 2
Code Structure: Imports and a small manager class are logically organized, but many unused imports add clutter. Nesting: The method has shallow control structure; nested calls introduce only modest visual complexity. Clarity of intent: Permission lookup by codename and content type is understandable, but get2 and abbreviated parameters cod, app, and mod obscure the API's purpose. Code length: The implementation is concise, although the import block is disproportionately long for the shown functionality. Action granularity: Each statement performs a cohesive action; the embedded content-type lookup combines two operations but remains readable. Reading flow: Conventional indentation and multiline keyword arguments support natural reading, though the split app, mod arguments and weak naming slightly disrupt it.
Run 3
Code Structure: The manager class and its single method are logically organized, but numerous unused imports obscure the small implementation. Nesting: Control flow is flat; nested method calls introduce only modest visual complexity. Clarity of intent: Django APIs make the permission lookup understandable, but get2 and the abbreviated parameters cod, app, and mod poorly communicate their meaning. Code length: The method is concise, while the import block is unnecessarily long for the shown code. Action granularity: Operations are cleanly formatted, although content-type retrieval is embedded in the permission lookup rather than expressed separately. Reading flow: The return expression flows naturally with clear keyword arguments, but excess imports and weak naming slow comprehension.