Skip to content

Commit

Permalink
Apply review suggestions to coverage filter checking
Browse files Browse the repository at this point in the history
[Cherry-picked 641f5db]
  • Loading branch information
KacperFKorban authored and WojciechMazur committed Jul 2, 2024
1 parent bfb2a7b commit d3a3461
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ class InstrumentCoverage extends MacroTransform with IdentityDenotTransformer:
Serializer.serialize(coverage, outputPath, ctx.settings.sourceroot.value)

private def isClassIncluded(sym: Symbol)(using Context): Boolean =
val fqn = sym.fullName.toText(ctx.printerFn(ctx)).show
coverageExcludeClasslikePatterns.isEmpty || !coverageExcludeClasslikePatterns.exists(
_.matcher(sym.fullName.toText(ctx.printerFn(ctx)).show).nn.matches
_.matcher(fqn).nn.matches
)

private def isFileIncluded(file: SourceFile)(using Context): Boolean =
val normalizedPath = file.path.replace(".scala", "")
coverageExcludeFilePatterns.isEmpty || !coverageExcludeFilePatterns.exists(
_.matcher(file.path.replace(".scala", "")).nn.matches
_.matcher(normalizedPath).nn.matches
)

override protected def newTransformer(using Context) =
Expand Down

0 comments on commit d3a3461

Please # to comment.