@@ -81,6 +81,10 @@ object Main extends IOApp:
8181 lang,
8282 AnalyzerConfig (inex, input, tmp, fmts, out),
8383 ) =>
84+ val ext = lang match
85+ case SupportedLanguage .Java (_, _) => " .java"
86+ case SupportedLanguage .Python => " .py"
87+ case SupportedLanguage .EO => " .eo"
8488 for
8589 tempDir <- tmp match
8690 case Some (path) =>
@@ -96,6 +100,38 @@ object Main extends IOApp:
96100 .getOrElse(List ())
97101
98102 _ <- warnMissingKeys(parsedKeys, EOAnalyzer .analyzers.map(_.ruleId))
103+ input <- input match
104+ case Input .FromDirectory (dir) => dir.pure[IO ]
105+ case Input .FromFile (file) =>
106+ for
107+ singleFileCodeDir <-
108+ (tempDir / " singleFile" ).unsafeToDirectory.createDirIfDoesntExist
109+ singleFileCodePath =
110+ (singleFileCodeDir / (file.filenameNoExt + ext)).unsafeToFile
111+ singleFileCodeFile <-
112+ singleFileCodePath.unsafeToFile.createFileIfDoesntExist
113+ _ <- readCodeFromFile(ext, file)
114+ .map(_._2)
115+ .through(fs2.text.utf8.encode)
116+ .through(Files [IO ].writeAll(singleFileCodePath))
117+ .compile
118+ .drain
119+ yield singleFileCodeDir
120+ case Input .FromStdin =>
121+ for
122+ stdinCodeDir <-
123+ (tempDir / " stdin" ).unsafeToDirectory.createDirIfDoesntExist
124+ stdinCodeFilePath =
125+ (stdinCodeDir / (" stdin" + ext)).unsafeToFile
126+ stdinCodeFile <- stdinCodeFilePath.createFileIfDoesntExist
127+ _ <-
128+ readCodeFromStdin
129+ .through(fs2.text.utf8.encode)
130+ .through(Files [IO ].writeAll(stdinCodeFilePath))
131+ .compile
132+ .drain
133+ yield stdinCodeDir
134+
99135 processedConfig = ProcessedConfig (
100136 filteredAnalyzers = filterAnalyzers(inex),
101137 tempDir = tempDir,
0 commit comments