Skip to content

Commit a620621

Browse files
committed
🐛 修復測試錯誤
1 parent 59c509f commit a620621

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

src/core/validation/validator.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,19 @@ export class Validator {
155155
const key = normalizeRequirementName(block.name);
156156
totalDeltas++;
157157
if (addedNames.has(key)) {
158-
issues.push({ level: 'ERROR', path: entryPath, message: `Duplicate requirement in ADDED: "${block.name}"` });
158+
issues.push({ level: 'ERROR', path: entryPath, message: `新增區段中有重複的需求:「${block.name}` });
159159
} else {
160160
addedNames.add(key);
161161
}
162162
const requirementText = this.extractRequirementText(block.raw);
163163
if (!requirementText) {
164-
issues.push({ level: 'ERROR', path: entryPath, message: `ADDED "${block.name}" is missing requirement text` });
164+
issues.push({ level: 'ERROR', path: entryPath, message: `新增「${block.name}」缺少需求文字` });
165165
} else if (!this.containsShallOrMust(requirementText)) {
166-
issues.push({ level: 'ERROR', path: entryPath, message: `ADDED "${block.name}" must contain SHALL or MUST` });
166+
issues.push({ level: 'ERROR', path: entryPath, message: `新增「${block.name}」必須包含 SHALL MUST` });
167167
}
168168
const scenarioCount = this.countScenarios(block.raw);
169169
if (scenarioCount < 1) {
170-
issues.push({ level: 'ERROR', path: entryPath, message: `ADDED "${block.name}" must include at least one scenario` });
170+
issues.push({ level: 'ERROR', path: entryPath, message: `新增「${block.name}」必須至少包含一個情境` });
171171
}
172172
}
173173

@@ -176,19 +176,19 @@ export class Validator {
176176
const key = normalizeRequirementName(block.name);
177177
totalDeltas++;
178178
if (modifiedNames.has(key)) {
179-
issues.push({ level: 'ERROR', path: entryPath, message: `Duplicate requirement in MODIFIED: "${block.name}"` });
179+
issues.push({ level: 'ERROR', path: entryPath, message: `修改區段中有重複的需求:「${block.name}` });
180180
} else {
181181
modifiedNames.add(key);
182182
}
183183
const requirementText = this.extractRequirementText(block.raw);
184184
if (!requirementText) {
185-
issues.push({ level: 'ERROR', path: entryPath, message: `MODIFIED "${block.name}" is missing requirement text` });
185+
issues.push({ level: 'ERROR', path: entryPath, message: `修改「${block.name}」缺少需求文字` });
186186
} else if (!this.containsShallOrMust(requirementText)) {
187-
issues.push({ level: 'ERROR', path: entryPath, message: `MODIFIED "${block.name}" must contain SHALL or MUST` });
187+
issues.push({ level: 'ERROR', path: entryPath, message: `修改「${block.name}」必須包含 SHALL MUST` });
188188
}
189189
const scenarioCount = this.countScenarios(block.raw);
190190
if (scenarioCount < 1) {
191-
issues.push({ level: 'ERROR', path: entryPath, message: `MODIFIED "${block.name}" must include at least one scenario` });
191+
issues.push({ level: 'ERROR', path: entryPath, message: `修改「${block.name}」必須至少包含一個情境` });
192192
}
193193
}
194194

@@ -197,7 +197,7 @@ export class Validator {
197197
const key = normalizeRequirementName(name);
198198
totalDeltas++;
199199
if (removedNames.has(key)) {
200-
issues.push({ level: 'ERROR', path: entryPath, message: `Duplicate requirement in REMOVED: "${name}"` });
200+
issues.push({ level: 'ERROR', path: entryPath, message: `移除區段中有重複的需求:「${name}` });
201201
} else {
202202
removedNames.add(key);
203203
}
@@ -209,12 +209,12 @@ export class Validator {
209209
const toKey = normalizeRequirementName(to);
210210
totalDeltas++;
211211
if (renamedFrom.has(fromKey)) {
212-
issues.push({ level: 'ERROR', path: entryPath, message: `Duplicate FROM in RENAMED: "${from}"` });
212+
issues.push({ level: 'ERROR', path: entryPath, message: `重新命名區段中有重複的來源名稱:「${from}` });
213213
} else {
214214
renamedFrom.add(fromKey);
215215
}
216216
if (renamedTo.has(toKey)) {
217-
issues.push({ level: 'ERROR', path: entryPath, message: `Duplicate TO in RENAMED: "${to}"` });
217+
issues.push({ level: 'ERROR', path: entryPath, message: `重新命名區段中有重複的目標名稱:「${to}` });
218218
} else {
219219
renamedTo.add(toKey);
220220
}
@@ -223,25 +223,25 @@ export class Validator {
223223
// Cross-section conflicts (within the same spec file)
224224
for (const n of modifiedNames) {
225225
if (removedNames.has(n)) {
226-
issues.push({ level: 'ERROR', path: entryPath, message: `Requirement present in both MODIFIED and REMOVED: "${n}"` });
226+
issues.push({ level: 'ERROR', path: entryPath, message: `需求同時出現在修改和移除區段:「${n}` });
227227
}
228228
if (addedNames.has(n)) {
229-
issues.push({ level: 'ERROR', path: entryPath, message: `Requirement present in both MODIFIED and ADDED: "${n}"` });
229+
issues.push({ level: 'ERROR', path: entryPath, message: `需求同時出現在修改和新增區段:「${n}` });
230230
}
231231
}
232232
for (const n of addedNames) {
233233
if (removedNames.has(n)) {
234-
issues.push({ level: 'ERROR', path: entryPath, message: `Requirement present in both ADDED and REMOVED: "${n}"` });
234+
issues.push({ level: 'ERROR', path: entryPath, message: `需求同時出現在新增和移除區段:「${n}` });
235235
}
236236
}
237237
for (const { from, to } of plan.renamed) {
238238
const fromKey = normalizeRequirementName(from);
239239
const toKey = normalizeRequirementName(to);
240240
if (modifiedNames.has(fromKey)) {
241-
issues.push({ level: 'ERROR', path: entryPath, message: `MODIFIED references old name from RENAMED. Use new header for "${to}"` });
241+
issues.push({ level: 'ERROR', path: entryPath, message: `修改區段引用了重新命名的舊名稱,請使用新標題:「${to}` });
242242
}
243243
if (addedNames.has(toKey)) {
244-
issues.push({ level: 'ERROR', path: entryPath, message: `RENAMED TO collides with ADDED for "${to}"` });
244+
issues.push({ level: 'ERROR', path: entryPath, message: `重新命名的目標名稱與新增區段衝突:「${to}` });
245245
}
246246
}
247247
}
@@ -253,14 +253,14 @@ export class Validator {
253253
issues.push({
254254
level: 'ERROR',
255255
path: specPath,
256-
message: `Delta sections ${this.formatSectionList(sections)} were found, but no requirement entries parsed. Ensure each section includes at least one "### Requirement:" block (REMOVED may use bullet list syntax).`,
256+
message: `找到差異區段 ${this.formatSectionList(sections)},但沒有解析到任何需求項目。請確保每個區段至少包含一個「### Requirement:」或「### 需求:」區塊(移除區段可使用項目符號列表語法)。`,
257257
});
258258
}
259259
for (const path of missingHeaderSpecs) {
260260
issues.push({
261261
level: 'ERROR',
262262
path,
263-
message: 'No delta sections found. Add headers such as "## ADDED Requirements" or move non-delta notes outside specs/.',
263+
message: '找不到差異區段。請加入標題如「## 新增需求」或「## ADDED Requirements」,或將非差異說明移到 specs/ 目錄外。',
264264
});
265265
}
266266

@@ -349,10 +349,10 @@ export class Validator {
349349
if (msg === VALIDATION_MESSAGES.CHANGE_NO_DELTAS) {
350350
return `${msg}. ${VALIDATION_MESSAGES.GUIDE_NO_DELTAS}`;
351351
}
352-
if (msg.includes('Spec must have a Purpose section') || msg.includes('Spec must have a Requirements section')) {
352+
if (msg.includes('規範必須包含目的區段') || msg.includes('規範必須包含需求區段')) {
353353
return `${msg}. ${VALIDATION_MESSAGES.GUIDE_MISSING_SPEC_SECTIONS}`;
354354
}
355-
if (msg.includes('Change must have a Why section') || msg.includes('Change must have a What Changes section')) {
355+
if (msg.includes('變更必須包含為什麼區段') || msg.includes('變更必須包含變更內容區段')) {
356356
return `${msg}. ${VALIDATION_MESSAGES.GUIDE_MISSING_CHANGE_SECTIONS}`;
357357
}
358358
return msg;

0 commit comments

Comments
 (0)