Skip to content

Commit

Permalink
handle invalid file path when reading astGen result (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
khemrajrathore authored Oct 1, 2024
1 parent 8b27081 commit 148ed9e
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,16 +259,18 @@ class AstGenRunner(config: Config) {

private def filterFiles(files: List[String], out: File): List[String] = {
files.filter { file =>
file.stripSuffix(".json").replace(out.pathAsString, config.inputPath) match {
// We are not interested in JS / TS type definition files at this stage.
// TODO: maybe we can enable that later on and use the type definitions there
// for enhancing the CPG with additional type information for functions
case filePath if TypeDefinitionFileExtensions.exists(filePath.endsWith) => false
case filePath if isIgnoredByUserConfig(filePath) => false
case filePath if isIgnoredByDefault(filePath) => false
case filePath if isTranspiledFile(filePath) => false
case _ => true
}
Try {
file.stripSuffix(".json").replace(out.pathAsString, config.inputPath) match {
// We are not interested in JS / TS type definition files at this stage.
// TODO: maybe we can enable that later on and use the type definitions there
// for enhancing the CPG with additional type information for functions
case filePath if TypeDefinitionFileExtensions.exists(filePath.endsWith) => false
case filePath if isIgnoredByUserConfig(filePath) => false
case filePath if isIgnoredByDefault(filePath) => false
case filePath if isTranspiledFile(filePath) => false
case _ => true
}
}.getOrElse(false)
}
}

Expand Down

0 comments on commit 148ed9e

Please sign in to comment.