feat(backend): add static analysis rule for unreachable python code#370
feat(backend): add static analysis rule for unreachable python code#370DeepeshKafalatiya wants to merge 9 commits into
Conversation
|
Hi maintainers! I have successfully implemented the Please review my changes and let me know if any updates are needed. Kindly link this PR to my assigned issue and tag it under GSSoC 2026 and add lables. Thank you! 🚀🔥 |
|
Hi @imDarshanGK, Please take a look here I have successfully implemented the UnreachableCodeDetector logic using Python's native ast parser and verified it locally using the Swagger UI docs interface. Please review my changes and let me know if any updates are needed. Kindly link this PR to my assigned issue and tag it under GSSoC 2026 and add lables. Thank you! 🚀🔥 |
|
Hi @imDarshanGK 👋 Just wanted to let you know that I have successfully resolved all the merge conflicts on this PR. It is now clean, green, and completely ready for review. Could you please take a look when you get a moment? Thank you so much for your time! 🚀 Please review my changes and let me know if any updates are needed. Kindly link this PR to my assigned issue and tag it under GSSoC 2026 and add lables. Thank you! 🚀🔥 |
|
Hi @imDarshanGK! I have cleaned up the indentation formatting and fully resolved the merge conflicts. The branch is now clean and ready for review. Could you please approve and trigger the workflow checks when you get a moment? Thank you! 🚀 |
|
@DeepeshKafalatiya Resolve conflicts |
|
Hi @imDarshanGK! I have successfully resolved the latest merge conflicts directly on GitHub. The branch is completely up to date with the main branch and ready for review. Could you please approve and trigger the workflow checks whenever you get a chance? Thank you so much! 🚀 |
|
@DeepeshKafalatiya update the branch with the latest main changes |
|
Hi @imDarshanGK! Could you please approve the workflow checks and review it when you are free? Thank you! 🚀 |

Description
This PR implements a native, lightweight static analysis rule using Python's
ast(Abstract Syntax Tree) module to detect unreachable/dead code blocks. Specifically, it flags any non-empty code lines that occur directly after terminating structural keywords (return,break,continue) within the same scope.The rule logic has been successfully integrated into both primary analysis endpoints:
POST /analyze/) — appends to thepayload["debugging"]["issues"]structure.POST /analyze/zip/) — safely handles individual file dictionaries with a solid key-fallback structure.Related Issue
Fixes #328
Type of change
Checklist
mainpytest -vand all tests passfeat/fix/docs/test: short descriptionScreenshots (if frontend change)
N/A (Backend change verified locally via Swagger UI docs platform)
Test evidence