Skip to content

Commit 2e350f1

Browse files
committed
decoupled warning about missing keys and filtering
1 parent af95120 commit 2e350f1

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

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

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,9 @@ object Main extends IOApp:
4444
)
4545

4646
def filterAnalyzers(
47-
availableAnalyzers: List[EOAnalyzer],
48-
inex: Option[IncludeExclude],
49-
): IO[List[EOAnalyzer]] =
50-
val givenKeys = inex
51-
.map {
52-
case Include(list) => list.toList
53-
case Exclude(list) => list.toList
54-
}
55-
.getOrElse(List())
56-
57-
for _ <- warnMissingKeys(givenKeys, availableAnalyzers.map(_.ruleId))
58-
yield inex match
47+
inex: Option[IncludeExclude]
48+
): List[EOAnalyzer] =
49+
inex match
5950
case Some(Exclude(exclude)) =>
6051
analyzers.mapFilter { case a =>
6152
Option.unless(exclude.contains_(a.ruleId))(a)
@@ -89,10 +80,16 @@ object Main extends IOApp:
8980
IO.println(s"Cleaning ${path.absolute}...") *>
9081
path.createDirIfDoesntExist.flatMap(_.clean)
9182
case None => Files[IO].createTempDirectory
83+
parsedKeys = inex
84+
.map {
85+
case Include(list) => list.toList
86+
case Exclude(list) => list.toList
87+
}
88+
.getOrElse(List())
9289

93-
filtered <- filterAnalyzers(EOAnalyzer.analyzers, inex)
90+
_ <- warnMissingKeys(parsedKeys, EOAnalyzer.analyzers.map(_.ruleId))
9491
processedConfig = ProcessedConfig(
95-
filteredAnalyzers = filtered,
92+
filteredAnalyzers = filterAnalyzers(inex),
9693
tempDir = tempDir,
9794
output = out,
9895
input = input,

0 commit comments

Comments
 (0)