MCPcopy
hub / github.com/CopyTranslator/CopyTranslator / checkStatus

Method checkStatus

src/common/configParser.ts:99–120  ·  view source on GitHub ↗
(key: Identifier, value: any)

Source from the content-addressed store, hash-verified

97 }
98
99 checkStatus(key: Identifier, value: any): CheckResult {
100 if (value == undefined) {
101 return {
102 canSave: false,
103 canEnable: false,
104 saveReason: "配置为空",
105 enableReason: "配置为空",
106 };
107 }
108 const check = this.getRule(key).check;
109 if (!check) {
110 return { canSave: true, canEnable: true };
111 }
112 const status = this.normalizeCheckResult(check(value));
113 if (!status.canSave && !status.saveReason) {
114 status.saveReason = "配置未通过校验";
115 }
116 if (!status.canEnable && !status.enableReason) {
117 status.enableReason = "配置未通过校验";
118 }
119 return status;
120 }
121
122 private normalizeCheckResult(result: boolean | CheckResult): CheckResult {
123 if (typeof result === "boolean") {

Callers 1

checkValidMethod · 0.95

Calls 2

getRuleMethod · 0.95
normalizeCheckResultMethod · 0.95

Tested by

no test coverage detected