Skip to content

Commit

Permalink
Merge pull request #5329 from inception-project/refactoring/5328-Stop…
Browse files Browse the repository at this point in the history
…-enabling-all-CAS-doctor-checks-on-beta-and-SNAPSHOT-versions

#5328 - Stop enabling all CAS doctor checks on beta and SNAPSHOT versions
  • Loading branch information
reckart authored Mar 4, 2025
2 parents 7c74520 + 0ba609f commit 3ec3ec9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -50,7 +49,7 @@ public class CasDoctor
private Set<String> activeRepairs;

private boolean fatalChecks = true;
private boolean disableAutoScan = false;
// private boolean disableAutoScan = false;

public CasDoctor(CasDoctorProperties aProperties, ChecksRegistry aChecksRegistry,
RepairsRegistry aRepairsRegistry)
Expand All @@ -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())) {
Expand All @@ -78,7 +77,7 @@ public CasDoctor(ChecksRegistry aChecksRegistry, RepairsRegistry aRepairsRegistr
repairsRegistry = aRepairsRegistry;

fatalChecks = false;
disableAutoScan = true;
// disableAutoScan = true;

activeChecks = new LinkedHashSet<>();
activeRepairs = new LinkedHashSet<>();
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ public interface CasDoctorProperties

boolean isFatal();

boolean isForceReleaseBehavior();
// boolean isForceReleaseBehavior();
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class CasDoctorPropertiesImpl
private List<String> checks = Collections.emptyList();
private List<String> repairs = Collections.emptyList();
private boolean fatal = true;
private boolean forceReleaseBehavior = false;
// private boolean forceReleaseBehavior = false;

@Override
public List<String> getChecks()
Expand Down Expand Up @@ -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;
// }
}

0 comments on commit 3ec3ec9

Please sign in to comment.