All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.joern.kotlin2cpg.passes.ConfigPass.scala Maven / Gradle / Ivy

The newest version!
package io.joern.kotlin2cpg.passes

import io.joern.kotlin2cpg.FileContentAtPath
import io.shiftleft.codepropertygraph.generated.Cpg
import io.shiftleft.codepropertygraph.generated.nodes.NewConfigFile
import io.shiftleft.passes.ForkJoinParallelCpgPass
import org.slf4j.LoggerFactory

class ConfigPass(fileContentsAtPath: Iterable[FileContentAtPath], cpg: Cpg)
    extends ForkJoinParallelCpgPass[FileContentAtPath](cpg) {

  private val logger = LoggerFactory.getLogger(getClass)

  override def generateParts(): Array[FileContentAtPath] = fileContentsAtPath.toArray

  override def runOnPart(diffGraph: DiffGraphBuilder, fileContent: FileContentAtPath): Unit = {
    logger.debug(s"Adding file `${fileContent.filename}` as config.")
    val configNode = NewConfigFile().name(fileContent.relativizedPath).content(fileContent.content)
    diffGraph.addNode(configNode)
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy