정수형 UI 숫자 표기 검증
This commit is contained in:
31
tools/verify/integer-format.mjs
Normal file
31
tools/verify/integer-format.mjs
Normal file
@@ -0,0 +1,31 @@
|
||||
import { readFileSync, readdirSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const cbDir = 'tools/deck/cb';
|
||||
const files = readdirSync(cbDir).filter((name) => name.endsWith('.mjs'));
|
||||
const violations = [];
|
||||
|
||||
for (const file of files) {
|
||||
const source = readFileSync(join(cbDir, file), 'utf8');
|
||||
const matches = source.match(/["']\/ui\/[^"']*["']\s*\.\.\s*tostring\(/g) || [];
|
||||
for (const match of matches) violations.push(`${file}: ${match}`);
|
||||
}
|
||||
|
||||
const generator = readFileSync('tools/deck/gen-slaydeck.mjs', 'utf8');
|
||||
if (!generator.includes('normalizeIntegerStrings(common)')) {
|
||||
violations.push('gen-slaydeck.mjs: common.gamelogic integer-string normalization is missing');
|
||||
}
|
||||
|
||||
const common = readFileSync('Global/common.gamelogic', 'utf8');
|
||||
const commonIntegerDecimals = common.match(/(?<![0-9.])-?[0-9]+\.0+(?![0-9])/g) || [];
|
||||
if (commonIntegerDecimals.length > 0) {
|
||||
violations.push(`Global/common.gamelogic: integer decimal values ${commonIntegerDecimals.length}`);
|
||||
}
|
||||
|
||||
if (violations.length > 0) {
|
||||
console.error('UI path integer formatting violations:');
|
||||
for (const violation of violations) console.error(`- ${violation}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`integer format: UI path tostring violations 0, common integer decimals 0 (${files.length} modules checked)`);
|
||||
Reference in New Issue
Block a user