-
Notifications
You must be signed in to change notification settings - Fork 10
feat(callgraph): Add Python statement extraction for intra-procedural dataflow #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
shivasurya
merged 2 commits into
main
from
feat/intra-procedural-dataflow-pr2-statement-extraction
Nov 4, 2025
Merged
feat(callgraph): Add Python statement extraction for intra-procedural dataflow #344
shivasurya
merged 2 commits into
main
from
feat/intra-procedural-dataflow-pr2-statement-extraction
Nov 4, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Owner
Author
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #344 +/- ##
==========================================
+ Coverage 75.50% 75.79% +0.29%
==========================================
Files 49 50 +1
Lines 5699 5929 +230
==========================================
+ Hits 4303 4494 +191
- Misses 1221 1244 +23
- Partials 175 191 +16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
This was referenced Nov 4, 2025
Owner
Author
Merge activity
|
… dataflow Implements statement-level extraction from Python AST to support intra-procedural dataflow analysis and taint propagation. This is PR #2 of the intra-procedural dataflow feature implementation. **Key Features:** - Extract assignments, augmented assignments, calls, and returns - Build def-use information for each statement - Conservative identifier extraction for security analysis - Handle Python AST node wrapping (expression_statement) - Filter Python keywords and 'self' references - Extract method names from chained calls (obj.a.b.method) **Implementation Details:** - `ExtractStatements`: Main entry point, iterates function body - `extractAssignment`: Handles simple assignments (x = expr) - Stores RHS expression in CallTarget field - Skips tuple unpacking (requires multiple defs) - Skips attribute/subscript assignments (no local defs) - `extractAugmentedAssignment`: Handles x += expr (def and use) - `extractCall`: Extracts function/method calls - CallTarget contains method name (not full chain) - CallArgs contains literal argument values - Uses contains all identifiers (recursive extraction) - `extractReturn`: Handles return statements - Stores expression in CallTarget - `extractIdentifiers`: Recursive identifier extraction - Filters Python keywords and 'self' - Deduplicates results **Test Coverage:** - 20+ comprehensive tests covering all statement types - 87.3% overall coverage - Edge cases: empty functions, control flow skipped, nested calls - Tests for keyword filtering, deduplication, self references **Compliance:** - All tests passing - Build successful - Linter clean (nolint comments for false-positive unconvert warnings) Related to #340 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…erage Adds 15+ additional tests to improve coverage from 87.3% to 87.7%. **New Test Coverage:** - Augmented assignment with attributes/subscripts - Complex call target expressions (lambda calls) - Nil node safety checks - Line number tracking - Nested keyword arguments - Assignment from literals - Return with multiple identifiers - Edge cases for defensive coding **Coverage Improvements:** - extractIdentifiersFromArgs: 92.0% → 96.0% - extractCallArgs: 91.3% → 95.7% - extractIdentifiers: 88.9% → 94.4% - ExtractStatements: 88.9% → 92.6% 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
9f592e5 to
980d41f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Summary
Implements Python statement extraction from AST to support intra-procedural dataflow analysis. This is part 2 of the intra-procedural dataflow feature.
Changes
Testing
Stacked on #343
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]