mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 18:54:17 +00:00
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:
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user