Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-opus-5· anthropicHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION [BUG][auto] deadcode-trailing-semicolon-empty-stmt: trailing-semicolon…

  1. User

    ISSUE DESCRIPTION

    [BUG][auto] deadcode-trailing-semicolon-empty-stmt: trailing-semicolon empty statement reported as unreachable warning (code=";", col 0-0)

    Description

    The dead-code detector emits a warning-severity unreachable_branch finding whose code field is a bare ; (an empty statement) whenever a return/raise statement is written with a trailing semicolon. In Python a trailing ; is a valid (if unusual) statement separator, so raise X; parses as raise X followed by an empty statement. That empty statement is technically unreachable, but reporting a no-op as actionable dead code is pure noise — there is nothing for the user to "remove" beyond a stylistic semicolon, and the finding points at literal ; with an impossible 0-0 column range.

    Repro

    Minimal synthetic Python (semi_repro.py):

    def f(x):
        if x is None:
            raise ValueError("nope");
        return x
    
    
    def g(y):
        return y;
    

    Run:

    pyscn analyze --json --no-open semi_repro.py
    

    Actual output

    Two dead-code findings (from the generated JSON report):

    {"function_name": "f", "location": {"start_line": 3, "start_column": 0, "end_column": 0}, "code": ";", "reason": "unreachable_branch", "severity": "warning"}
    {"function_name": "g", "location": {"start_line": 8, "start_column": 0, "end_column": 0}, "code": ";", "reason": "unreachable_branch", "severity": "warning"}
    

    Expected behavior

    Empty statements (the no-op produced by a trailing ;) should be filtered out before emitting dead-code findings — they carry no actionable signal. At most this is a low-severity style hint ("redundant trailing semicolon"), not a warning-severity unreachable-code finding. The 0-0 column range is also a symptom of the synthetic/empty node being reported.

    Priority rationale

    P2 (visible but bounded inaccuracy, per the FP-audit rubric): the gist isn't wrong (the ; truly follows a terminating statement), but the output is misleading — a warning that points at literal ; with a 0-0 column range reads as a real defect when there is none. Bounded impact: only fires on the rare trailing-semicolon style.

    Suggested fix (good first issue)

    Skip CFG nodes that correspond to empty statements (Python pass-equivalent / bare ; separators) when collecting unreachable-branch findings in the dead-code analyzer.


    pyscn version: v1.22.5 (commit bac7f16)

    Found via the FP-audit skill in repo bioconvert/bioconvert@92f4655 (4 real occurrences: bioconvert/utils/biocode/gff.py:618, tbl.py:114, things.py:753 and :780).

    Interface

    No new interfaces are introduced.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /pyscn, current file: none) bash-$

  2. Claude Assistant

    I'll start by exploring the repository.

  3. Claude Assistant

    Now let me implement the fix.

  4. Claude Assistant

    Now update analyzeDeadBlock to skip no-op-only blocks and use meaningful statements.

  5. Claude Assistant

    Now add the helper functions and make line/code helpers use meaningful statements.

  6. Claude Assistant

    Now rebuild and test with the repro.

  7. Claude Assistant

    Checklist review:

    • Reproduced the reported error: Yes. I built the binary (go build ./cmd/pyscn), created the exact repro file from the issue, ran pyscn analyze --json --no-open semi_repro.py, and confirmed two unreachable_branch warning findings with code: ";" and 0-0 columns.
    • Confirmed fix resolves the error: Yes. After the change, the same repro yields zero dead-code findings (dead_code.files is null, summary counts 0), and pyscn check passes on it.
    • Edge cases considered: Yes —
      • Mixed blocks (return y; print(y)) still report the real unreachable print(y) and no longer include ; in the code field.
      • Genuinely unreachable code (return then print, return then pass) is still reported with correct severity/reason, so the fix isn't overly broad.
      • Multiple/consecutive semicolons after continue;/break;/raise ...; in methods and classes produce no noise findings.
      • DeadBlocks counter and HasDeadCode() are kept consistent (no-op-only blocks are no longer counted), so dead_blocks/ratios and DetectInFile inclusion don't leak phantom dead blocks.
      • Nil/empty-block guards preserved; line/code helpers fall back to raw statements if all statements are no-ops (used by predecessor line comparisons).
    • Ran existing tests: Yes. go test ./... passes for all packages (analyzer, service, app, integration, cmd, etc.), plus gofmt/go vet are clean. I did not modify or add any tests, and I removed all temporary files.

    Submitting the change now.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.