Sample
pyint-a65d95876168-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.306 | 0–1; higher is more readable |
| Mi | 0.551 | 0–1; higher is more readable |
| LLOC | 58 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 8.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.344 | 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. | 2962.12 | −97.75 |
| Source linesThe number of non-empty source lines. | 112 | +44.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.408 | −6.612 |
Intercept 8.87 + feature contributions = -50.692 (log-odds).
Score = sigmoid(-50.692) = 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. | 113 | −2.965 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 83 | +2.134 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 83 | −1.484 |
| 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. | 117 | −1.29 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 111.822 | +1.153 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 117 | +1.083 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.047 | +0.481 |
Intercept 0.07 + feature contributions = -0.817 (log-odds).
Score = sigmoid(-0.817) = 0.306.
| Score | 0.551 |
|---|
| Score | 58 |
|---|
Run 1
The code has clear intent and documentation, but its readability is severely hampered by poor formatting and structure. Long lines with excessive whitespace in `_make_token_with_timestamp` and `_make_hash_value` break visual flow and make them hard to parse. Multiple statements per line (e.g., `str(self._get_secret())` and nested property definitions) violate action granularity. Inconsistent spacing around methods, missing blank lines, and inline comments (`# Parse the token`) further reduce clarity. While the token generation logic is logically separated into methods, the physical structure is disorganized, increasing cognitive load. Fixing line breaks, aligning whitespace, and adding consistent spacing would significantly improve readability.
Run 2
The code has a clear overall purpose and reasonable class-level organization, but readability suffers from inconsistent formatting, missing blank lines between methods, and unusual line breaks/indentation in several places (e.g., salted_hmac call, login_timestamp assignment). The check_token method includes multiple nested try/except blocks and a loop with an else clause, which adds some complexity. Action granularity is mixed: some lines bundle multiple operations or have awkward spacing, while others are appropriately separated. The reading flow is disrupted by long conditional expressions and inconsistent spacing around operators and parentheses. Docstrings help with intent, but the inconsistent style and occasional dense expressions make the code harder to follow than necessary.
Run 3
The code suffers from poor readability due to missing blank lines between class methods, which makes the structure difficult to scan. Some lines contain multiple operations or are excessively long, violating the 'one action per line' principle. The `_make_token_with_timestamp` method has significant alignment and spacing issues that obscure the logic. While the algorithm logic is generally sound and comments exist, the formatting undermines the natural reading flow. The overall structure requires substantial formatting fixes to be considered readable.
Run 1
1. Code Structure: Well-organized class with focused methods separating token generation, validation, configuration, and hashing; missing blank lines weaken visual separation. 2. Nesting: Mostly shallow, with early returns keeping validation straightforward. The for/else construct requires some familiarity. 3. Clarity of intent: Descriptive method names, docstrings, and comments explain the purpose and security-related decisions, though abbreviations such as ts_b36 require interpretation. 4. Code length: Implementation is reasonably concise; the longer hashing docstring provides useful context rather than unnecessary verbosity. 5. Action granularity: Most statements perform one clear action, but the compressed salted_hmac arguments and awkward conditional-expression formatting impede scanning. 6. Reading flow: Methods follow a logical progression, but inconsistent spacing, crowded method boundaries, and the unusually split hexdigest slice disrupt otherwise natural reading.
Run 2
Code Structure: Responsibilities are logically separated into token generation, validation, configuration properties, and hashing helpers. Nesting: Early returns keep validation mostly flat; the loop and conditional introduce only shallow nesting. Clarity of intent: Descriptive method names, docstrings, and comments explain the security-related behavior, although abbreviated timestamp variables and the loop-else construct require some familiarity. Code length: Implementation is reasonably concise; the lengthy hashing docstring provides useful context rather than unnecessary repetition. Action granularity: Statements generally perform one action per line, though the compressed HMAC arguments and conditional expression reduce scanability. Reading flow: Methods follow a sensible progression, but inconsistent blank lines between methods, excessive inline spacing, and awkward wrapping of the hash slice and login timestamp interrupt otherwise natural reading.
Run 3
Code Structure: The class is logically organized into token generation, validation, configuration properties, and supporting helpers, though inconsistent blank lines weaken separation. Nesting: Early returns keep validation relatively flat; the loop with an else clause adds modest complexity. Clarity of intent: Descriptive method names, docstrings, and comments explain the security logic well, although abbreviated timestamp variables require interpretation. Code length: Methods are concise and focused; the longer explanatory docstring is useful rather than unnecessary. Action granularity: Most statements perform one clear action, but the compressed HMAC call and awkward conditional-expression formatting obscure individual operations. Reading flow: Validation follows a natural parse, verify, and expiration-check sequence, but excessive inline spacing, irregular line breaks, and crowded method boundaries interrupt scanning.