Skip to content

feature: Add relationship between core entities to make it persistable in database #195

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

Open
wants to merge 111 commits into
base: main
Choose a base branch
from

Conversation

shivasurya
Copy link
Owner

Description:

This PR adds relationship between the entities which should help to store them in relational format. Creating relationship between the entities reduces drastically search space to filter nodes while codeql query is executed. Further more adopting #190 class support further drives to implement class and filters by the end users to reduce the search space.

⚠️ One caveat I'm okay with is that if the end user crafts the query without relationship between entities will obviously trigger cartesian product and waste memory and computing time. We could warn the user by checking the cardinality of the dataset before filtering or generating cartesian product and let the user decide to run the query.

Checklist:

  • Tests passing (gradle testGo)?
  • Lint passing (golangci-lint run this requires golangci-lint)?

@shivasurya shivasurya added the enhancement New feature or request label Feb 2, 2025
@shivasurya shivasurya self-assigned this Feb 2, 2025
Copy link

codecov bot commented Feb 19, 2025

Codecov Report

Attention: Patch coverage is 74.31598% with 582 lines in your changes missing coverage. Please review.

Project coverage is 69.28%. Comparing base (2337e5f) to head (7b04260).

Files with missing lines Patch % Lines
sourcecode-parser/eval/evaluator.go 34.93% 181 Missing and 22 partials ⚠️
sourcecode-parser/model/reftype.go 64.87% 69 Missing and 3 partials ⚠️
sourcecode-parser/model/member.go 61.17% 65 Missing and 1 partial ⚠️
sourcecode-parser/model/expr.go 78.43% 53 Missing and 5 partials ⚠️
sourcecode-parser/tree/construct.go 79.92% 40 Missing and 12 partials ⚠️
sourcecode-parser/cmd/query.go 0.00% 43 Missing ⚠️
sourcecode-parser/db/db.go 57.14% 24 Missing and 12 partials ⚠️
sourcecode-parser/tree/query.go 69.23% 29 Missing and 7 partials ⚠️
sourcecode-parser/tree/java/parse_method.go 95.09% 6 Missing and 2 partials ⚠️
sourcecode-parser/cmd/ci.go 0.00% 7 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #195      +/-   ##
==========================================
- Coverage   72.42%   69.28%   -3.15%     
==========================================
  Files          16       33      +17     
  Lines        2473     3086     +613     
==========================================
+ Hits         1791     2138     +347     
- Misses        639      872     +233     
- Partials       43       76      +33     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shivasurya shivasurya requested a review from Copilot April 15, 2025 14:08
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 59 out of 60 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • sourcecode-parser/go.mod: Language not supported
Comments suppressed due to low confidence (3)

sourcecode-parser/cmd/query.go:161

  • The refactored header output now uses 'MethodDecl.SourceDeclaration' and 'MethodDecl.ID' instead of the previously used file and line number fields. Please verify that these fields consistently represent the desired information across all entity types.
header := fmt.Sprintf("	File: %s, Line: %s \n", greenCode(entity.MethodDecl.SourceDeclaration), greenCode(entity.MethodDecl.ID))

sourcecode-parser/antlr/listener_impl.go:246

  • The logic for building the expression tree in ExitEqualityExpression assumes that exactly three stack elements are available for a binary operation. Please double-check that this condition properly handles all valid cases in the grammar.
if len(l.currentExpression) >= 3 {

sourcecode-parser/antlr/listener_impl.go:370

  • When initializing the currentExpression stack for the root WHERE clause in EnterExpression, ensure that this reset does not inadvertently discard any necessary state from nested expressions.
l.currentExpression = make([]*ExpressionNode, 0)

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