Skip to content

Commit 7c21359

Browse files
committed
paths in .sarif.json should be correct now
1 parent 210c9d1 commit 7c21359

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/main/scala/org/polystat/cli/EO.scala

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ object EO:
2727

2828
def analyze(cfg: ProcessedConfig): IO[Unit] =
2929
val inputFiles = readCodeFromInput(".eo", cfg.input)
30-
val analyzed = inputFiles
30+
val analyze = inputFiles
3131
.evalMap { case (codePath, code) =>
3232
for
3333
_ <- IO.println(s"Analyzing $codePath...")
@@ -37,7 +37,7 @@ object EO:
3737
.compile
3838
.toVector
3939

40-
def writeToDirs(analyzed: Vector[(Path, List[OdinAnalysisResult])]) =
40+
def writeToDirs(analyzed: Vector[(Path, List[OdinAnalysisResult])]): IO[Unit] =
4141
analyzed.traverse_ { case (codePath, results) =>
4242
for
4343
_ <- if cfg.output.console then IO.println(analyzed) else IO.unit
@@ -69,8 +69,16 @@ object EO:
6969
}
7070
}
7171

72+
def pathToDisplay(relPath: Path) = cfg.input match
73+
case Input.FromDirectory(dir) => dir / relPath
74+
// TODO: account for other cases
75+
// This should be the same pass that is created when running readCodeFromX
76+
case _ => relPath
77+
7278
for
73-
analyzed <- analyzed
79+
analyzed <- analyze.map(_.map { case (path, results) =>
80+
(pathToDisplay(path), results)
81+
})
7482
_ <- cfg.output.dirs.traverse_ { outDir =>
7583
for
7684
_ <- IO.println(s"Cleaning $outDir before writing...")

src/main/scala/org/polystat/cli/Main.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ object Main extends IOApp:
8181
input = input,
8282
fmts = fmts,
8383
)
84-
analysisResults: IO[Unit] =
84+
analysisResults <-
8585
lang match
8686
case SupportedLanguage.EO => EO.analyze(processedConfig)
8787
case SupportedLanguage.Java(j2eo, j2eoVersion) =>

src/main/scala/org/polystat/sarif/SarifOutput.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ object SarifOutput:
3131
invocations = errors.map(SarifOutput.sarifInvocation),
3232
artifacts = Seq(
3333
SarifArtifact(location =
34-
SarifArtifactLocation(uri = filePath.toNioPath.toUri.toString)
34+
SarifArtifactLocation(uri =
35+
filePath.absolute.toNioPath.toUri.toString
36+
)
3537
)
3638
),
3739
)

0 commit comments

Comments
 (0)