fix(quality): resolve reliability findings on dev

The Sonar quality gate rated new code D. Preserve focus and keyboard interaction through native controls and shared dialog behavior. Replace ambiguous regex scans with bounded parsing and make numeric coercion and initialization explicit.
This commit is contained in:
Maurice
2026-12-01 21:06:05 +01:00
parent 0d6a432967
commit e539860530
127 changed files with 548 additions and 338 deletions
+8 -5
View File
@@ -363,11 +363,14 @@ function migrationNamesFromCopy(script: string): string[] {
return match !== null && !isPluginSchemaName(match[1] ?? '');
});
if (copy < 0) return [];
const columns =
/\(([^)]*)\)/
.exec(lines[copy])?.[1]
.split(',')
.map((column) => column.trim()) ?? [];
const header = lines[copy];
const start = header.indexOf('(') + 1;
const end = header.indexOf(')', start);
if (end === -1) return [];
const columns = header
.slice(start, end)
.split(',')
.map((column) => column.trim());
const nameAt = columns.indexOf('name');
if (nameAt < 0) return [];
const names: string[] = [];
@@ -69,7 +69,7 @@ export function pluginColumnKind(declaredType: string, storage: ReadonlySet<stri
return storage.size === 0 && declared.includes('BLOB') ? 'bytes' : 'text';
}
const NUMBER_LITERAL = /^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i;
const NUMBER_LITERAL = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
const INTEGER_LITERAL = /^[+-]?\d+$/;
const STRING_LITERAL = /^'(?:[^']|'')*'$/s;
@@ -64,7 +64,7 @@ const INT64_MIN = -(2n ** 63n);
const INT64_MAX = 2n ** 63n - 1n;
const SAFE_MAX = BigInt(Number.MAX_SAFE_INTEGER);
const DECIMAL_INTEGER = /^[+-]?\d+$/;
const DECIMAL_NUMBER = /^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i;
const DECIMAL_NUMBER = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
const NUL = '\u0000';
/** Why a value holding a NUL character is refused. */