Skip to content
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

Support tuple deconstruction and follow value flows based on index #1961

Merged
merged 14 commits into from
Jan 24, 2025

Conversation

KuechA
Copy link
Contributor

@KuechA KuechA commented Jan 22, 2025

  • Add functionality to split up the DFG of a statement like (a, b) = ... where the edges are labeled with a new index granularity.
  • Add test
  • Try with and without brackets
  • Use this also in other scenarios (tuples in a return value)
  • Special follow DFG functions which have a stack of indices and only select matching tuple elements for unpacking

Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 83.00654% with 26 lines in your changes missing coverage. Please review.

Project coverage is 77.89%. Comparing base (a5f4ec4) to head (1e2a475).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...kotlin/de/fraunhofer/aisec/cpg/graph/Extensions.kt 77.65% 5 Missing and 16 partials ⚠️
...er/aisec/cpg/passes/ControlFlowSensitiveDFGPass.kt 88.57% 0 Missing and 4 partials ⚠️
...ofer/aisec/cpg/passes/PythonAddDeclarationsPass.kt 92.85% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
...fraunhofer/aisec/cpg/graph/edges/flows/Dataflow.kt 91.48% <100.00%> (+3.11%) ⬆️
...n/kotlin/de/fraunhofer/aisec/cpg/passes/DFGPass.kt 83.69% <100.00%> (+0.45%) ⬆️
...ofer/aisec/cpg/passes/PythonAddDeclarationsPass.kt 90.54% <92.85%> (+1.14%) ⬆️
...er/aisec/cpg/passes/ControlFlowSensitiveDFGPass.kt 80.82% <88.57%> (+0.97%) ⬆️
...kotlin/de/fraunhofer/aisec/cpg/graph/Extensions.kt 59.30% <77.65%> (+4.38%) ⬆️

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@KuechA
Copy link
Contributor Author

KuechA commented Jan 24, 2025

We cover the basic cases of #1089 but miss some of the tests in #1807, in particular, we do not split up strings into characters nor do we handle the case of the * unpacking operator which seems rather specific to python.

Copy link
Member

@oxisto oxisto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general, minor details needed. We need to have a discussion about our different non-full dataflow types at some point but for now this is the best solution to our problem. Please make the PR title a little more meaningful ;)

@KuechA KuechA changed the title Try ugly hack to handle tuples on lhs of assignment Support tuple deconstruction and follow value flows based on index Jan 24, 2025
@oxisto oxisto merged commit 24ba314 into main Jan 24, 2025
4 checks passed
@oxisto oxisto deleted the ak/dfg-for-tuple-assignments branch January 24, 2025 11:15
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.

3 participants