Sample
pyint-d35884649787-I01
Remove comments and docstrings
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.62 | 0–1; higher is more readable |
| Mi | 0.392 | 0–1; higher is more readable |
| LLOC | 39 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.452 | 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. | 2105.341 | −69.476 |
| Source linesThe number of non-empty source lines. | 57 | +22.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.383 | −6.575 |
Intercept 8.87 + feature contributions = -44.381 (log-odds).
Score = sigmoid(-44.381) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 57 | +1.234 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 58 | −1.017 |
| 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 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 56.888 | +0.385 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.068 | +0.281 |
| 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. | 87.931 | −0.059 |
Intercept 0.07 + feature contributions = 0.488 (log-odds).
Score = sigmoid(0.488) = 0.62.
| Score | 0.392 |
|---|
| Score | 39 |
|---|
Run 1
The code is well-structured and readable. It uses clear class and method definitions with logical ordering. The 'RegexValidator' class has clear attributes and an '__init__' method that sets parameters with sensible defaults. Nesting is minimal, with only one level of indentation in the '__call__' and '__eq__' methods. Intent is evident from class and method names, and docstrings or comments are absent but not necessary due to clarity. Code length is concise, avoiding redundancy. Action granularity is appropriate, with each line performing a single clear action, except for the combined boolean assignment in '__call__', which is still understandable. Reading flow is natural, from imports to class definition to methods. Minor deductions for the slightly complex 'invalid_input' line and lack of type hints, but overall the code is highly readable.
Run 2
The code is generally readable and well-structured. It has a clear class definition with logical organization of constants and methods. Nesting is minimal, with no deep indentation levels. The intent of the class is clear as a regex validation utility. The __init__ method handles optional parameters cleanly, though it could be slightly more concise using a dictionary for parameter assignment. The __call__ method is straightforward with clear variable naming. The __eq__ method is readable but the boolean comparison chain is a bit lengthy. Overall, the code follows Django conventions and is maintainable, but loses points for some repetitive parameter handling and slightly verbose comparison logic.
Run 3
The code is highly readable with clear class structure, minimal nesting, and explicit intent. Each method has a single responsibility and follows Django conventions. The __init__ parameter handling is concise with predictable defaults and logical validation. The __call__ method uses a flat, two-line conditional approach where the inverse_match logic is clearly expressed. The __eq__ method is straightforward despite its length, with each comparison on separate lines aiding readability. Minor deductions: the blank line after the __call__ signature is an unnecessary gap, and the __eq__ method could be slightly more concise. Overall, the code demonstrates excellent structure, clear naming, and natural reading flow without unnecessary complexity.
Run 1
Code Structure: The class logically groups defaults, initialization, validation, and equality comparison; several unused imports add clutter. Nesting: Shallow conditionals keep the code easy to follow. Clarity of intent: Descriptive names and explicit error messages make the validator's purpose clear, although inverse-match logic requires slight interpretation. Code length: Compact overall, with reasonable repetition for optional attribute overrides. Action granularity: Each statement performs one clear action, and multiline expressions are sensibly formatted. Reading flow: Methods follow a natural progression, though the stray blank line in __call__ and unnecessary parentheses in parts of __eq__ slightly reduce polish.
Run 2
Code Structure: The class is logically organized into defaults, initialization, validation, and equality comparison, though several unused imports add clutter. Nesting: Control flow is shallow, with straightforward conditionals and no deeply nested blocks. Clarity of intent: Descriptive names and conventional validator methods make the purpose clear; the inverse-match expression requires a little extra interpretation. Code length: The implementation is concise overall, although initialization repeats similar checks and the import list is unnecessarily long for this snippet. Action granularity: Statements generally perform one action per line, and multiline expressions are formatted clearly. Reading flow: Methods follow a natural sequence, with consistent indentation and readable line wrapping; a stray blank line and redundant comparison parentheses slightly reduce polish.
Run 3
Code Structure: The class is logically organized into defaults, initialization, validation, and equality comparison, though several imports are unused in this snippet. Nesting: Shallow conditionals keep the code easy to follow. Clarity of intent: Descriptive names clearly communicate configurable regex validation; the inverse-match expression requires a little extra thought. Code length: Concise overall, with some repetitive but straightforward initialization checks. Action granularity: Each statement performs a single clear action, and multiline expressions are formatted appropriately. Reading flow: Methods follow a natural sequence, and consistent formatting supports scanning. Missing explanatory documentation and minor whitespace issues slightly reduce readability.