From b9304ba0cfbdc2a79c8f3c0d49fb7bc2ef187116 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 18 Nov 2024 02:34:55 -0500 Subject: [PATCH] Exclude logger classes from test coverage metrics Nobody cares if logger.trace has never been called... --- .../software/coley/recaf/analytics/logging/DebuggingLogger.java | 2 ++ .../coley/recaf/analytics/logging/InterceptingLogger.java | 2 ++ .../java/software/coley/recaf/analytics/logging/Logging.java | 2 ++ .../coley/recaf/analytics/logging/RecafLoggingFilter.java | 2 ++ 4 files changed, 8 insertions(+) diff --git a/recaf-core/src/main/java/software/coley/recaf/analytics/logging/DebuggingLogger.java b/recaf-core/src/main/java/software/coley/recaf/analytics/logging/DebuggingLogger.java index b5f53caf5..cb182738e 100644 --- a/recaf-core/src/main/java/software/coley/recaf/analytics/logging/DebuggingLogger.java +++ b/recaf-core/src/main/java/software/coley/recaf/analytics/logging/DebuggingLogger.java @@ -2,6 +2,7 @@ import jakarta.annotation.Nonnull; import org.slf4j.Logger; +import software.coley.recaf.util.ExcludeFromJacocoGeneratedReport; import java.util.function.Consumer; @@ -11,6 +12,7 @@ * * @author Matt Coley */ +@ExcludeFromJacocoGeneratedReport(justification = "Logging not relevant for test coverage") public interface DebuggingLogger extends Logger { boolean DEBUG = System.getenv("RECAF_DEBUG") != null; diff --git a/recaf-core/src/main/java/software/coley/recaf/analytics/logging/InterceptingLogger.java b/recaf-core/src/main/java/software/coley/recaf/analytics/logging/InterceptingLogger.java index 01fbdb65d..d989de3f9 100644 --- a/recaf-core/src/main/java/software/coley/recaf/analytics/logging/InterceptingLogger.java +++ b/recaf-core/src/main/java/software/coley/recaf/analytics/logging/InterceptingLogger.java @@ -4,6 +4,7 @@ import org.slf4j.Logger; import org.slf4j.Marker; import org.slf4j.event.Level; +import software.coley.recaf.util.ExcludeFromJacocoGeneratedReport; import java.util.regex.Matcher; @@ -12,6 +13,7 @@ * * @author Matt Coley */ +@ExcludeFromJacocoGeneratedReport(justification = "Logging not relevant for test coverage") public abstract class InterceptingLogger implements DebuggingLogger { private final Logger backing; diff --git a/recaf-core/src/main/java/software/coley/recaf/analytics/logging/Logging.java b/recaf-core/src/main/java/software/coley/recaf/analytics/logging/Logging.java index df600eaaf..8478ce2b9 100644 --- a/recaf-core/src/main/java/software/coley/recaf/analytics/logging/Logging.java +++ b/recaf-core/src/main/java/software/coley/recaf/analytics/logging/Logging.java @@ -7,6 +7,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.event.Level; +import software.coley.recaf.util.ExcludeFromJacocoGeneratedReport; import java.nio.file.Path; import java.util.ArrayList; @@ -26,6 +27,7 @@ * * @author Matt Coley */ +@ExcludeFromJacocoGeneratedReport(justification = "Logging not relevant for test coverage") public class Logging { private static final Map loggers = new ConcurrentHashMap<>(); private static final NavigableSet loggerKeys = Collections.synchronizedNavigableSet(new TreeSet<>()); diff --git a/recaf-core/src/main/java/software/coley/recaf/analytics/logging/RecafLoggingFilter.java b/recaf-core/src/main/java/software/coley/recaf/analytics/logging/RecafLoggingFilter.java index 1b3af9db4..e15606c51 100644 --- a/recaf-core/src/main/java/software/coley/recaf/analytics/logging/RecafLoggingFilter.java +++ b/recaf-core/src/main/java/software/coley/recaf/analytics/logging/RecafLoggingFilter.java @@ -4,12 +4,14 @@ import ch.qos.logback.core.filter.Filter; import ch.qos.logback.core.spi.FilterReply; import jakarta.annotation.Nonnull; +import software.coley.recaf.util.ExcludeFromJacocoGeneratedReport; /** * Logging filter impl that only allows Recaf logger calls. * * @author Matt Coley */ +@ExcludeFromJacocoGeneratedReport(justification = "Logging not relevant for test coverage") public class RecafLoggingFilter extends Filter { @Override public FilterReply decide(@Nonnull ILoggingEvent event) {