Skip to content

feat: build AST-based Python analyzer using built-in ast module (closes #169)#242

Open
antharya05 wants to merge 8 commits into
imDarshanGK:mainfrom
antharya05:feat/ast-python-analyzer-169
Open

feat: build AST-based Python analyzer using built-in ast module (closes #169)#242
antharya05 wants to merge 8 commits into
imDarshanGK:mainfrom
antharya05:feat/ast-python-analyzer-169

Conversation

@antharya05
Copy link
Copy Markdown

Description

Implemented an AST-based Python analyzer using Python’s built-in ast module for deeper and more accurate bug detection beyond the existing regex-based approach.

Changes made

  • Added backend/app/services/ast_analyzer.py

  • Implemented PythonASTAnalyzer using ast.NodeVisitor

  • Added AST-based detections for:

    • mutable default arguments
    • bare except:
    • eval() / exec() usage
    • built-in shadowing
    • unreachable code after return / raise
  • Added graceful syntax error handling

  • Integrated AST analysis into run_bug_detection() for Python

  • Preserved existing regex pipeline for compatibility

  • Added comprehensive AST analyzer test suite

  • Added rate-limit reset fixture to prevent test leakage between endpoint tests

Related Issue

Fixes #169

Type of change

  • Bug fix
  • New feature / enhancement
  • Documentation update
  • Test addition
  • Refactor

Checklist

  • I have read [CONTRIBUTING.md](../CONTRIBUTING.md)
  • My branch is up to date with main
  • I have run pytest -v and all tests pass
  • I have not introduced duplicate issues or features
  • My PR title follows the format: feat/fix/docs/test: short description
  • I have added tests for new features (Level 2 and 3 issues)
  • No hardcoded secrets or API keys in my code
  • This PR is linked to a GSSoC 2026 issue

Screenshots (if frontend change)

N/A — backend feature only.

Screenshot 2026-05-22 114314

@antharya05 antharya05 requested a review from imDarshanGK as a code owner May 22, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build AST-based Python analyzer using the built-in ast module

1 participant