From 6c76c2627aa1db4b7f527ced966aa924e7f343b3 Mon Sep 17 00:00:00 2001 From: Richard Eckart de Castilho Date: Tue, 4 Mar 2025 11:07:47 +0100 Subject: [PATCH] #5328 - Stop enabling all CAS doctor checks on beta and SNAPSHOT versions - Commented out relevant code --- .../ukp/clarin/webanno/diag/CasDoctor.java | 31 +++++++++---------- .../diag/config/CasDoctorProperties.java | 2 +- .../diag/config/CasDoctorPropertiesImpl.java | 22 ++++++------- 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/inception/inception-diag/src/main/java/de/tudarmstadt/ukp/clarin/webanno/diag/CasDoctor.java b/inception/inception-diag/src/main/java/de/tudarmstadt/ukp/clarin/webanno/diag/CasDoctor.java index 0f9cafd6a8c..c304894719c 100644 --- a/inception/inception-diag/src/main/java/de/tudarmstadt/ukp/clarin/webanno/diag/CasDoctor.java +++ b/inception/inception-diag/src/main/java/de/tudarmstadt/ukp/clarin/webanno/diag/CasDoctor.java @@ -36,7 +36,6 @@ import de.tudarmstadt.ukp.clarin.webanno.diag.config.CasDoctorProperties; import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument; -import de.tudarmstadt.ukp.inception.support.SettingsUtil; import de.tudarmstadt.ukp.inception.support.logging.LogMessage; public class CasDoctor @@ -50,7 +49,7 @@ public class CasDoctor private Set activeRepairs; private boolean fatalChecks = true; - private boolean disableAutoScan = false; + // private boolean disableAutoScan = false; public CasDoctor(CasDoctorProperties aProperties, ChecksRegistry aChecksRegistry, RepairsRegistry aRepairsRegistry) @@ -59,7 +58,7 @@ public CasDoctor(CasDoctorProperties aProperties, ChecksRegistry aChecksRegistry repairsRegistry = aRepairsRegistry; fatalChecks = aProperties.isFatal(); - disableAutoScan = aProperties.isForceReleaseBehavior(); + // disableAutoScan = aProperties.isForceReleaseBehavior(); activeChecks = new LinkedHashSet<>(); if (isNotEmpty(aProperties.getChecks())) { @@ -78,7 +77,7 @@ public CasDoctor(ChecksRegistry aChecksRegistry, RepairsRegistry aRepairsRegistr repairsRegistry = aRepairsRegistry; fatalChecks = false; - disableAutoScan = true; + // disableAutoScan = true; activeChecks = new LinkedHashSet<>(); activeRepairs = new LinkedHashSet<>(); @@ -216,18 +215,18 @@ public void setActiveRepairs(String... aActiveRepairs) public void onApplicationStartedEvent(ApplicationStartedEvent aEvent) { // When under development, automatically enable all checks. - var version = SettingsUtil.getVersionProperties().getProperty(SettingsUtil.PROP_VERSION); - if ("unknown".equals(version) || version.contains("-SNAPSHOT") - || version.contains("-beta-")) { - if (disableAutoScan) { - LOG.info("Detected SNAPSHOT/beta version - but FORCING release mode and NOT " - + "auto-enabling checks"); - } - else { - checksRegistry.getExtensions().forEach(check -> activeChecks.add(check.getId())); - LOG.info("Detected SNAPSHOT/beta version - automatically enabling all checks"); - } - } + // var version = SettingsUtil.getVersionProperties().getProperty(SettingsUtil.PROP_VERSION); + // if ("unknown".equals(version) || version.contains("-SNAPSHOT") + // || version.contains("-beta-")) { + // if (disableAutoScan) { + // LOG.info("Detected SNAPSHOT/beta version - but FORCING release mode and NOT " + // + "auto-enabling checks"); + // } + // else { + // checksRegistry.getExtensions().forEach(check -> activeChecks.add(check.getId())); + // LOG.info("Detected SNAPSHOT/beta version - automatically enabling all checks"); + // } + // } for (var checkId : activeChecks) { LOG.info("Check activated: " + checkId); diff --git a/inception/inception-diag/src/main/java/de/tudarmstadt/ukp/clarin/webanno/diag/config/CasDoctorProperties.java b/inception/inception-diag/src/main/java/de/tudarmstadt/ukp/clarin/webanno/diag/config/CasDoctorProperties.java index cdb7af0d4ac..562b1e18799 100644 --- a/inception/inception-diag/src/main/java/de/tudarmstadt/ukp/clarin/webanno/diag/config/CasDoctorProperties.java +++ b/inception/inception-diag/src/main/java/de/tudarmstadt/ukp/clarin/webanno/diag/config/CasDoctorProperties.java @@ -27,5 +27,5 @@ public interface CasDoctorProperties boolean isFatal(); - boolean isForceReleaseBehavior(); + // boolean isForceReleaseBehavior(); } diff --git a/inception/inception-diag/src/main/java/de/tudarmstadt/ukp/clarin/webanno/diag/config/CasDoctorPropertiesImpl.java b/inception/inception-diag/src/main/java/de/tudarmstadt/ukp/clarin/webanno/diag/config/CasDoctorPropertiesImpl.java index 068ff5e59dd..ac10550bfba 100644 --- a/inception/inception-diag/src/main/java/de/tudarmstadt/ukp/clarin/webanno/diag/config/CasDoctorPropertiesImpl.java +++ b/inception/inception-diag/src/main/java/de/tudarmstadt/ukp/clarin/webanno/diag/config/CasDoctorPropertiesImpl.java @@ -29,7 +29,7 @@ public class CasDoctorPropertiesImpl private List checks = Collections.emptyList(); private List repairs = Collections.emptyList(); private boolean fatal = true; - private boolean forceReleaseBehavior = false; + // private boolean forceReleaseBehavior = false; @Override public List getChecks() @@ -64,14 +64,14 @@ public void setFatal(boolean aFatal) fatal = aFatal; } - @Override - public boolean isForceReleaseBehavior() - { - return forceReleaseBehavior; - } - - public void setForceReleaseBehavior(boolean aForceReleaseBehavior) - { - forceReleaseBehavior = aForceReleaseBehavior; - } + // @Override + // public boolean isForceReleaseBehavior() + // { + // return forceReleaseBehavior; + // } + // + // public void setForceReleaseBehavior(boolean aForceReleaseBehavior) + // { + // forceReleaseBehavior = aForceReleaseBehavior; + // } }