-
Notifications
You must be signed in to change notification settings - Fork 73
Renaming nodes to be shorter and more consistent #1303
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
Conversation
Personally, I wouldn't shorten I do agree with
One question we could explore is whether to drop the added |
|
@oxisto @KuechA I don't see us dropping the suffix of Statement, Expression, Declaration completely because there are some node names that would be misleading or collide, e.g. |
Is this something that we can get rid of? Why can't |
This would make EVERY block of statements an expression, but although I had an initial repulsion to the thought I see it as less problematic the more I think of it. @oxisto What do you think? |
We could do it similar to the We then have a property that denotes the usage as expression: Lines 79 to 84 in 463ac60
We afaik then check in the DFG (EOG?) passes if this property is set and set an additional DFG edge to itself. |
Ok, I see we ar edoing this, so I would say we just rename Can it work without using a variable like |
I think we need some kind of property to make the differentiation in the EOG and/or DFG because probably the last statement flows to the expression itself or something. Not sure how the EOG/DFG is implemented for |
I will see if it is necessary |
cpg-analysis/src/main/kotlin/de/fraunhofer/aisec/cpg/analysis/MultiValueEvaluator.kt
Outdated
Show resolved
Hide resolved
cpg-analysis/src/main/kotlin/de/fraunhofer/aisec/cpg/analysis/ValueEvaluator.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/statements/expressions/Reference.kt
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/statements/BlockStatement.kt
Outdated
Show resolved
Hide resolved
...c/main/kotlin/de/fraunhofer/aisec/cpg/graph/statements/expressions/SubscriptionExpression.kt
Outdated
Show resolved
Hide resolved
...core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/RecordTemplateDeclaration.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/UsingDeclaration.kt
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/scopes/BlockScope.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/RecordDeclaration.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/IncludeDeclaration.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/FunctionDeclaration.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/FunctionDeclaration.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/StatementBuilder.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/CXXCallResolverHelper.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/CallResolver.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/CallResolver.kt
Outdated
Show resolved
Hide resolved
cpg-language-java/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/java/StatementHandler.kt
Outdated
Show resolved
Hide resolved
…and BlockStatementExpression
…ntBuilder.kt Co-authored-by: KuechA <31155350+KuechA@users.noreply.github.com>
…cpg into refactor/renamingNodes
I would keep it as |
…ome variable names refactoring.
…n to refactor later by merging and spotless
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some smaller things. Looks good overall, I support the renamings
cpg-analysis/src/main/kotlin/de/fraunhofer/aisec/cpg/analysis/MultiValueEvaluator.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/builder/Fluent.kt
Outdated
Show resolved
Hide resolved
SonarCloud Quality Gate failed.
|
* Renaming nodes to be shorter and more consistent * Reverting Stmt back to Statement etc. * Fix naming in python * Finish renaming nodes * Replacing outdated names in docs * Updating names and related to node renaming, unifying BlockStatement and BlockStatementExpression * Spotless * Update cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/StatementBuilder.kt Co-authored-by: KuechA <31155350+KuechA@users.noreply.github.com> * Fix comments and naming * Adding Doc and fixing spotless * <fix some naming * Spotless * Fixing Tests * Fixing golang statement handler * Spotless go module * Renaming in tests * spotless * More Block name changes * Fixing import * newBlock is an Expression (used to be a statement) * Change edge name of conditional Expression.Fix Documentation and do some variable names refactoring. * Spotless * Finish renaming of variables still names Expr * Reverting InitializerExpression back to DesignatedInitializerEpression to refactor later by merging and spotless * Rename eci variables * Spotless * Renaming SubscriptionExpression to SubscriptExpression and fix comment with Block * Spotless * Spotless --------- Co-authored-by: KuechA <31155350+KuechA@users.noreply.github.com> Co-authored-by: Maximilian Kaul <maximilian.kaul@aisec.fraunhofer.de>
* Renaming nodes to be shorter and more consistent * Reverting Stmt back to Statement etc. * Fix naming in python * Finish renaming nodes * Replacing outdated names in docs * Updating names and related to node renaming, unifying BlockStatement and BlockStatementExpression * Spotless * Update cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/StatementBuilder.kt Co-authored-by: KuechA <31155350+KuechA@users.noreply.github.com> * Fix comments and naming * Adding Doc and fixing spotless * <fix some naming * Spotless * Fixing Tests * Fixing golang statement handler * Spotless go module * Renaming in tests * spotless * More Block name changes * Fixing import * newBlock is an Expression (used to be a statement) * Change edge name of conditional Expression.Fix Documentation and do some variable names refactoring. * Spotless * Finish renaming of variables still names Expr * Reverting InitializerExpression back to DesignatedInitializerEpression to refactor later by merging and spotless * Rename eci variables * Spotless * Renaming SubscriptionExpression to SubscriptExpression and fix comment with Block * Spotless * Spotless --------- Co-authored-by: KuechA <31155350+KuechA@users.noreply.github.com> Co-authored-by: Maximilian Kaul <maximilian.kaul@aisec.fraunhofer.de>
* Renaming nodes to be shorter and more consistent * Reverting Stmt back to Statement etc. * Fix naming in python * Finish renaming nodes * Replacing outdated names in docs * Updating names and related to node renaming, unifying BlockStatement and BlockStatementExpression * Spotless * Update cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/StatementBuilder.kt Co-authored-by: KuechA <31155350+KuechA@users.noreply.github.com> * Fix comments and naming * Adding Doc and fixing spotless * <fix some naming * Spotless * Fixing Tests * Fixing golang statement handler * Spotless go module * Renaming in tests * spotless * More Block name changes * Fixing import * newBlock is an Expression (used to be a statement) * Change edge name of conditional Expression.Fix Documentation and do some variable names refactoring. * Spotless * Finish renaming of variables still names Expr * Reverting InitializerExpression back to DesignatedInitializerEpression to refactor later by merging and spotless * Rename eci variables * Spotless * Renaming SubscriptionExpression to SubscriptExpression and fix comment with Block * Spotless * Spotless --------- Co-authored-by: KuechA <31155350+KuechA@users.noreply.github.com> Co-authored-by: Maximilian Kaul <maximilian.kaul@aisec.fraunhofer.de>
This PR introduces some renamings with the aim to make the node names more intuitive and more fluently usable when working with the query language and any console scripting interface. The main idea i followed was to name more consistently and omit unnecessary details
ParamVariableDeclaration
toParameterDeclaration
DeclaredReferenceExpression
toReference
to make it shorter and omitting theExpression
consistent withLiteral
.ArraySubscriptionExpression
toSubscriptionExpr
shorten further and because we use it for other subscriptable constructs that are no arrays.ClassTemplateDeclaration
toRecordTemplateDeclaration
to be consistent withRecordDeclaration
ArrayCreationExpression
toNewArrayExpression
: to better reflect that is only used in the new context and can beCompoundStatement
toBlock
: I think would be more intuitive.CompoundStatement
andCompoundStatementExpression
UsingDirective
toUsingDeclaration
due to it being a declarationExplicitConstructorInvocation
toConstructorCallExpression
to remove unnecessary explicit and invocation and signal that it is a call expressionTypeParamDeclaration
toTypeParameterDeclaration
for consistency