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

CPG Console #435

Merged
merged 34 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3d2ec7e
++
oxisto May 27, 2021
0a3d4e9
Added CPG console plugins
oxisto Jun 1, 2021
0316023
Merge branch 'master' into cpg-console
oxisto Jun 1, 2021
970da40
Added value resolver
oxisto Jun 1, 2021
c5a1fff
starting out of bounds check
oxisto Jun 1, 2021
922cefe
byName now supports a simple nested level
oxisto Jun 2, 2021
0d4f8ba
Shorter, more concise toString() output for console
oxisto Jun 2, 2021
b3bb438
Fixed test
oxisto Jun 2, 2021
45fc070
Simple Nullpointer detection
oxisto Jun 2, 2021
cf0f943
Fixed go tests
oxisto Jun 2, 2021
1e9f252
Code cleanup. Added CouldNotResolve class
oxisto Jun 2, 2021
07cefc1
nice formatting of NPE
oxisto Jun 2, 2021
8ac3465
First attempt at code coloring
oxisto Jun 2, 2021
ada2961
First integration of syntax highlighting in console
oxisto Jun 2, 2021
d9c4bbc
Added more coloring
oxisto Jun 2, 2021
d9081f9
Even more syntax highlighting
oxisto Jun 2, 2021
6099892
Tutorial
oxisto Jun 3, 2021
f7c56c9
added tutorial
oxisto Jun 3, 2021
15f482a
tutorial ++, but needs more shortcut functions
oxisto Jun 3, 2021
fe72ecb
Playing around with formatting
oxisto Jun 3, 2021
d036bae
Fixed stuff
oxisto Jun 8, 2021
8d80537
++
oxisto Jun 8, 2021
2dc1d84
++
oxisto Jun 8, 2021
3c9149e
++
oxisto Jun 8, 2021
aafc15f
++
oxisto Jun 8, 2021
3bd434f
better tostring
oxisto Jun 9, 2021
f53ebf4
++
oxisto Jun 9, 2021
d839086
Merge branch 'master' into cpg-console
oxisto Jun 11, 2021
fe4bb07
Merge branch 'master' into cpg-console
oxisto Jun 14, 2021
a0be96c
Deactivate go as default language
konradweiss Jun 21, 2021
85bf357
Revert "Deactivate go as default language"
konradweiss Jun 21, 2021
d027ae0
Some cleanup
oxisto Jun 21, 2021
dfe542b
Merge branch 'master' into cpg-console
oxisto Jun 21, 2021
c8c6999
Removing addition of experimental language
konradweiss Jun 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cpg-console/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf

5 changes: 5 additions & 0 deletions cpg-console/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
17 changes: 17 additions & 0 deletions cpg-console/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# CPG Console

```bash
../gradlew installDist
build/install/cpg-console/bin/cpg-console
```

The following example snippet can be used:

```kotlin
:a src/test/resources/array.cpp
Copy link
Collaborator

Choose a reason for hiding this comment

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

the :a command should be replaced with :tr I think.

var tu = result.translationUnits.first()
var main = tu.byName<FunctionDeclaration>("main")
:code main?
var decl = main?.body<DeclarationStatement>(0)
var v = decl?.singleDeclaration as? VariableDeclaration
```
63 changes: 63 additions & 0 deletions cpg-console/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2021, Fraunhofer AISEC. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $$$$$$\ $$$$$$$\ $$$$$$\
* $$ __$$\ $$ __$$\ $$ __$$\
* $$ / \__|$$ | $$ |$$ / \__|
* $$ | $$$$$$$ |$$ |$$$$\
* $$ | $$ ____/ $$ |\_$$ |
* $$ | $$\ $$ | $$ | $$ |
* \$$$$$ |$$ | \$$$$$ |
* \______/ \__| \______/
*
*/
plugins {
application
}

application {
mainClass.set("de.fraunhofer.aisec.cpg.console.CpgConsole")
}

tasks.withType<Test> {
useJUnitPlatform {
if (!project.hasProperty("integration")) {
excludeTags("integration")
}
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8" // important, since ki is 1.8 and otherwise inlining wont work
}

val versions = mapOf(
"junit5" to "5.6.0"
)

dependencies {
// CPG
api(project(":cpg-library"))
api(project(":cpg-neo4j"))

// JUnit
testImplementation("org.junit.jupiter", "junit-jupiter-api", versions["junit5"])
testImplementation("org.junit.jupiter", "junit-jupiter-params", versions["junit5"])
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", versions["junit5"])

implementation("org.jline:jline:3.20.0")

implementation("org.jetbrains.kotlinx:ki-shell:0.3.3")
}
Loading