Skip to content

Add invariant assertion for AST#2727

Draft
fwendland wants to merge 3 commits into
mainfrom
fw/ast-invariants-checks
Draft

Add invariant assertion for AST#2727
fwendland wants to merge 3 commits into
mainfrom
fw/ast-invariants-checks

Conversation

@fwendland
Copy link
Copy Markdown
Collaborator

@fwendland fwendland commented Apr 17, 2026

We want the ability to check invariants for an AST (abstract syntax tree). These invariants are a practical mean to ensure that new features don't break our specification of the CPG.

For the AST our invariants are (subject for discussions):

  • tree structure
  • for every node, every node.child.parent is node
  • ...

This PR supplies an initial proposal.

We add the invariant assertions as separate function to be called on demand.

Open integration:

  • Add to analyze() conditional to a flag (default: false)

@fwendland fwendland self-assigned this Apr 17, 2026
@fwendland fwendland added the enhancement New feature or request label Apr 17, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

❌ Patch coverage is 52.94118% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.02%. Comparing base (e72a491) to head (285d9b1).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...s/kotlin/de/fraunhofer/aisec/cpg/test/TestUtils.kt 52.94% 7 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
...s/kotlin/de/fraunhofer/aisec/cpg/test/TestUtils.kt 67.28% <52.94%> (-3.99%) ⬇️

... and 1 file with indirect coverage changes

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant