Skip to content

Commit

Permalink
Merge branch 'main' into mk/buildsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto authored Dec 2, 2024
2 parents 8d82ba2 + aad282e commit a66185e
Show file tree
Hide file tree
Showing 93 changed files with 2,933 additions and 762 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ cpg-neo4j @peckto

build.gradle.kts @oxisto
.github @oxisto

cpg-language-ini @maximiliankaul
12 changes: 10 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
build:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
Expand Down Expand Up @@ -68,11 +68,19 @@ jobs:
id: build
env:
VERSION: ${{ env.version }}
- name: Prepare report.xml for Codecov
run: |
# this is needed because codecov incorrectly reports lines that have no coverage information (good or bad) as a miss
# See https://github.com/codecov/feedback/issues/564 and https://github.com/Kotlin/kotlinx-kover/issues/699.
# Actually these lines should just not exist in the coverage XML file, since they are only structural elements, such
# as brackets.
cat cpg-all/build/reports/kover/report.xml | grep -v 'mi="0" ci="0" mb="0" cb="0"' > cpg-all/build/reports/kover/report-codecov.xml
rm cpg-all/build/reports/kover/report.xml
- name: Upload Code Coverage
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
files: ./cpg-all/build/reports/kover/report.xml
files: ./cpg-all/build/reports/kover/report-codecov.xml
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Prepare test and coverage reports
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ The current state of languages is:
| C++ | cpg-language-cxx | [main](https://github.com/Fraunhofer-AISEC/cpg) | `maintained` |
| Python | cpg-language-python | [main](https://github.com/Fraunhofer-AISEC/cpg) | `maintained` |
| Go | cpg-language-go | [main](https://github.com/Fraunhofer-AISEC/cpg) | `maintained` |
| INI | cpg-language-ini | [main](https://github.com/Fraunhofer-AISEC/cpg) | `maintained` |
| JVM (Bytecode) | cpg-language-jvm | [main](https://github.com/Fraunhofer-AISEC/cpg) | `incubating` |
| LLVM | cpg-language-llvm | [main](https://github.com/Fraunhofer-AISEC/cpg) | `incubating` |
| TypeScript/JavaScript | cpg-language-typescript | [main](https://github.com/Fraunhofer-AISEC/cpg) | `experimental` |
Expand Down
6 changes: 6 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,9 @@ val enableJVMFrontend: Boolean by extra {
enableJVMFrontend.toBoolean()
}
project.logger.lifecycle("JVM frontend is ${if (enableJVMFrontend) "enabled" else "disabled"}")

val enableINIFrontend: Boolean by extra {
val enableINIFrontend: String? by project
enableINIFrontend.toBoolean()
}
project.logger.lifecycle("INI frontend is ${if (enableINIFrontend) "enabled" else "disabled"}")
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ val enableLLVMFrontend: Boolean by rootProject.extra
val enableTypeScriptFrontend: Boolean by rootProject.extra
val enableRubyFrontend: Boolean by rootProject.extra
val enableJVMFrontend: Boolean by rootProject.extra
val enableINIFrontend: Boolean by rootProject.extra

dependencies {
if (enableJavaFrontend) {
Expand Down Expand Up @@ -46,4 +47,8 @@ dependencies {
api(project(":cpg-language-ruby"))
kover(project(":cpg-language-ruby"))
}
if (enableINIFrontend) {
api(project(":cpg-language-ini"))
kover(project(":cpg-language-ini"))
}
}
2 changes: 2 additions & 0 deletions configure_frontends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ answerRuby=$(ask "Do you want to enable the Ruby frontend? (currently $(getPrope
setProperty "enableRubyFrontend" $answerRuby
answerJVM=$(ask "Do you want to enable the JVM frontend? (currently $(getProperty "enableJVMFrontend"))")
setProperty "enableJVMFrontend" $answerJVM
answerINI=$(ask "Do you want to enable the INI frontend? (currently $(getProperty "enableINIFrontend"))")
setProperty "enableINIFrontend" $answerINI
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ fun executionPath(from: Node, to: Node): QueryTree<Boolean> {
* requirement specified in [predicate].
*/
fun executionPath(from: Node, predicate: (Node) -> Boolean): QueryTree<Boolean> {
val evalRes = from.followNextEOGEdgesUntilHit(predicate)
val evalRes = from.followNextEOGEdgesUntilHit(predicate = predicate)
val allPaths = evalRes.fulfilled.map { QueryTree(it) }.toMutableList()
allPaths.addAll(evalRes.failed.map { QueryTree(it) })
return QueryTree(
Expand All @@ -264,7 +264,7 @@ fun executionPath(from: Node, predicate: (Node) -> Boolean): QueryTree<Boolean>
* requirement specified in [predicate].
*/
fun executionPathBackwards(to: Node, predicate: (Node) -> Boolean): QueryTree<Boolean> {
val evalRes = to.followPrevEOGEdgesUntilHit(predicate)
val evalRes = to.followPrevEOGEdgesUntilHit(predicate = predicate)
val allPaths = evalRes.fulfilled.map { QueryTree(it) }.toMutableList()
allPaths.addAll(evalRes.failed.map { QueryTree(it) })
return QueryTree(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class TranslatePlugin : Plugin {
" .optionalLanguage(\"de.fraunhofer.aisec.cpg.frontends.golang.GoLanguage\")" +
" .optionalLanguage(\"de.fraunhofer.aisec.cpg.frontends.typescript.TypeScriptLanguage\")" +
" .optionalLanguage(\"de.fraunhofer.aisec.cpg.frontends.ruby.RubyLanguage\")" +
" .optionalLanguage(\"de.fraunhofer.aisec.cpg.frontends.ini.IniFileLanguage\")" +
" .defaultPasses()\n" +
" .useParallelPasses(false)\n" +
" .configurePass<de.fraunhofer.aisec.cpg.passes.ControlFlowSensitiveDFGPass>(\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ private constructor(
/** Enables the inference of variables, such as global variables. */
val inferVariables: Boolean,

/**
* A very EXPERIMENTAL feature. If this is enabled, we will try to infer return types of
* functions based on the context of the call it originated out of. This is disabled by default.
*/
val inferReturnTypes: Boolean,

/**
* Uses heuristics to add DFG edges for call expressions to unresolved functions (i.e.,
* functions not implemented in the given source code).
Expand All @@ -61,6 +67,7 @@ private constructor(
private var inferRecords: Boolean = true,
private var inferFunctions: Boolean = true,
private var inferVariables: Boolean = true,
private var inferReturnTypes: Boolean = false,
private var inferDfgForUnresolvedCalls: Boolean = true
) {
fun enabled(infer: Boolean) = apply { this.enabled = infer }
Expand All @@ -73,6 +80,8 @@ private constructor(

fun inferVariables(infer: Boolean) = apply { this.inferVariables = infer }

fun inferReturnTypes(infer: Boolean) = apply { this.inferReturnTypes = infer }

fun inferDfgForUnresolvedCalls(infer: Boolean) = apply {
this.inferDfgForUnresolvedCalls = infer
}
Expand All @@ -84,6 +93,7 @@ private constructor(
inferRecords,
inferFunctions,
inferVariables,
inferReturnTypes,
inferDfgForUnresolvedCalls
)
}
Expand Down
Loading

0 comments on commit a66185e

Please sign in to comment.