Files
schemaCheck/src/main/java/com/codechecker/cache/config/CheckerConfig.java
dongzi 110beb79c0
All checks were successful
缓存序列化结构检查 / cache-schema-check (push) Has been skipped
feat: 项目整体命名修改cache-schema-checker
2026-07-14 11:03:34 +08:00

335 lines
8.1 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.codechecker.cache.config;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 检测器运行配置。由 {@link ConfigLoader} 加载 jar 内默认配置并与业务配置深度合并后构建。
*/
public class CheckerConfig {
/** 总开关false 时跳过检测与通知(流水线 exit 0 */
private boolean enabled = true;
/** notify | block */
private String mode = "notify";
private boolean scanTestSources = false;
private List<String> sourceRoots = new ArrayList<>();
private Notify notify = new Notify();
private Ignore ignore = new Ignore();
private Detection detection = new Detection();
private Map<String, String> severityOverrides = new LinkedHashMap<>();
private List<ManualMapping> manualMappings = new ArrayList<>();
private List<Suppression> suppressions = new ArrayList<>();
private List<String> includeModules = new ArrayList<>();
private List<String> excludeModules = new ArrayList<>();
public static class Notify {
private boolean enabled = true;
/** 企微机器人 Webhook 完整 URL */
private String webhookUrl = "";
private boolean notifyOnClean = false;
private String titlePrefix = "[缓存结构变更]";
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getWebhookUrl() {
return webhookUrl;
}
public void setWebhookUrl(String webhookUrl) {
this.webhookUrl = webhookUrl;
}
public boolean isNotifyOnClean() {
return notifyOnClean;
}
public void setNotifyOnClean(boolean notifyOnClean) {
this.notifyOnClean = notifyOnClean;
}
public String getTitlePrefix() {
return titlePrefix;
}
public void setTitlePrefix(String titlePrefix) {
this.titlePrefix = titlePrefix;
}
}
public static class Ignore {
private List<String> keyPatterns = new ArrayList<>();
private List<String> filePatterns = new ArrayList<>();
private List<String> writerMethods = new ArrayList<>();
public List<String> getKeyPatterns() {
return keyPatterns;
}
public void setKeyPatterns(List<String> keyPatterns) {
this.keyPatterns = keyPatterns;
}
public List<String> getFilePatterns() {
return filePatterns;
}
public void setFilePatterns(List<String> filePatterns) {
this.filePatterns = filePatterns;
}
public List<String> getWriterMethods() {
return writerMethods;
}
public void setWriterMethods(List<String> writerMethods) {
this.writerMethods = writerMethods;
}
}
public static class Detection {
private List<String> patterns = new ArrayList<>();
private double minConfidence = 0.6;
private int maxFieldDepth = 8;
public List<String> getPatterns() {
return patterns;
}
public void setPatterns(List<String> patterns) {
this.patterns = patterns;
}
public double getMinConfidence() {
return minConfidence;
}
public void setMinConfidence(double minConfidence) {
this.minConfidence = minConfidence;
}
public int getMaxFieldDepth() {
return maxFieldDepth;
}
public void setMaxFieldDepth(int maxFieldDepth) {
this.maxFieldDepth = maxFieldDepth;
}
}
public static class ManualMapping {
private String id;
private String writerMethod;
private String keyPattern;
private String valueType;
private String description;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getWriterMethod() {
return writerMethod;
}
public void setWriterMethod(String writerMethod) {
this.writerMethod = writerMethod;
}
public String getKeyPattern() {
return keyPattern;
}
public void setKeyPattern(String keyPattern) {
this.keyPattern = keyPattern;
}
public String getValueType() {
return valueType;
}
public void setValueType(String valueType) {
this.valueType = valueType;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
public static class Suppression {
private String id;
private String writerMethod;
private String keyPattern;
private List<String> changeTypes = new ArrayList<>();
private String reason;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getWriterMethod() {
return writerMethod;
}
public void setWriterMethod(String writerMethod) {
this.writerMethod = writerMethod;
}
public String getKeyPattern() {
return keyPattern;
}
public void setKeyPattern(String keyPattern) {
this.keyPattern = keyPattern;
}
public List<String> getChangeTypes() {
return changeTypes;
}
public void setChangeTypes(List<String> changeTypes) {
this.changeTypes = changeTypes;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public boolean isScanTestSources() {
return scanTestSources;
}
public void setScanTestSources(boolean scanTestSources) {
this.scanTestSources = scanTestSources;
}
public List<String> getSourceRoots() {
return sourceRoots;
}
public void setSourceRoots(List<String> sourceRoots) {
this.sourceRoots = sourceRoots;
}
public Notify getNotify() {
return notify;
}
public void setNotify(Notify notify) {
this.notify = notify;
}
public Ignore getIgnore() {
return ignore;
}
public void setIgnore(Ignore ignore) {
this.ignore = ignore;
}
public Detection getDetection() {
return detection;
}
public void setDetection(Detection detection) {
this.detection = detection;
}
public Map<String, String> getSeverityOverrides() {
return severityOverrides;
}
public void setSeverityOverrides(Map<String, String> severityOverrides) {
this.severityOverrides = severityOverrides;
}
public List<ManualMapping> getManualMappings() {
return manualMappings;
}
public void setManualMappings(List<ManualMapping> manualMappings) {
this.manualMappings = manualMappings;
}
public List<Suppression> getSuppressions() {
return suppressions;
}
public void setSuppressions(List<Suppression> suppressions) {
this.suppressions = suppressions;
}
public List<String> getIncludeModules() {
return includeModules;
}
public void setIncludeModules(List<String> includeModules) {
this.includeModules = includeModules;
}
public List<String> getExcludeModules() {
return excludeModules;
}
public void setExcludeModules(List<String> excludeModules) {
this.excludeModules = excludeModules;
}
public boolean isBlockMode() {
return "block".equalsIgnoreCase(mode);
}
}