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

Convert Neo4j pre-save hooks to cpg pass #1224

Merged
merged 2 commits into from
Jul 21, 2023
Merged

Convert Neo4j pre-save hooks to cpg pass #1224

merged 2 commits into from
Jul 21, 2023

Conversation

peckto
Copy link
Collaborator

@peckto peckto commented Jun 23, 2023

In preparation for #1215

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. Maybe just a quick discussion: Should we have this pass in cog-core or in cpg-neo4j?

@oxisto
Copy link
Member

oxisto commented Jun 24, 2023

Ok it seems are test design for neo4j is really ... crap. We are setting up our own translation result here in the test instead of re-using the function that exists in the Application:

fun testPush() {
val topLevel = Paths.get("src").resolve("test").resolve("resources").toAbsolutePath()
val path = topLevel.resolve("client.cpp").toAbsolutePath()
val file = File(path.toString())
assert(file.exists() && !file.isDirectory && !file.isHidden)
val translationConfiguration =
TranslationConfiguration.builder()
.sourceLocations(file)
.topLevel(topLevel.toFile())
.defaultPasses()
.defaultLanguages()
.debugParser(true)
.build()
val translationManager =
TranslationManager.builder().config(translationConfiguration).build()
translationResult = translationManager.analyze().get()

@peckto Can you maybe merge this as part of this PR so that the test is actually using the prepared TR of the application?

@peckto peckto force-pushed the neo4j-pass branch 2 times, most recently from da389c9 to a629375 Compare July 21, 2023 12:14
@peckto
Copy link
Collaborator Author

peckto commented Jul 21, 2023

I reworked the ApplicationTest to use the setupTranslationConfiguration, including the arg parse interface.

@peckto
Copy link
Collaborator Author

peckto commented Jul 21, 2023

Looks good. Maybe just a quick discussion: Should we have this pass in cog-core or in cpg-neo4j?

I don't have a strong opinion on this.
Maybe the pass is (in future) also helpful for other serialization methods?
We could also rename the pass to something more generic like PrepareSerialization or similar.

@peckto
Copy link
Collaborator Author

peckto commented Jul 21, 2023

The pass is executed before FilenameMapper, as FilenameMapper is last, this will be second last.

@oxisto
Copy link
Member

oxisto commented Jul 21, 2023

Looks good. Maybe just a quick discussion: Should we have this pass in cog-core or in cpg-neo4j?

I don't have a strong opinion on this. Maybe the pass is (in future) also helpful for other serialization methods? We could also rename the pass to something more generic like PrepareSerialization or similar.

Renaming it to PrepareSerialization would be a good idea.

@sonarcloud
Copy link

sonarcloud bot commented Jul 21, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

88.9% 88.9% Coverage
0.0% 0.0% Duplication

@oxisto oxisto merged commit 5fbfa80 into main Jul 21, 2023
3 checks passed
@oxisto oxisto deleted the neo4j-pass branch July 21, 2023 13:34
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.

2 participants