diff --git a/.codacy.yml b/.codacy.yml index 2dabeae4..0b6498c5 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -9,20 +9,12 @@ engines: # Logic & Quality Metrics lizard: enabled: true - config: - thresholds: - cyclomatic_complexity: 10 - lines_of_code: 50 - arguments: 4 pmd7: enabled: true # CSS & Web Standards stylelint: enabled: true - config: - rules: - function-allowed-list: ["url", "var", "filter", "invert"] # Documentation & Config markdownlint: diff --git a/src/utilities/debug.ts b/src/utilities/debug.ts index b32a7e1d..f89c46e9 100644 --- a/src/utilities/debug.ts +++ b/src/utilities/debug.ts @@ -60,14 +60,20 @@ function getCallerName(stack?: string): string { return 'unknown function'; } - // Filter out empty lines and the logMessage itself to find the true caller - const caller = stack - .split('\n') - .filter(Boolean) - .map(parseStackLine) - .find((name) => name !== null && name !== 'logMessage'); + const lines = stack.split('\n'); - return caller ?? 'unknown function'; + for (const line of lines) { + if (!line) { + continue; + } + + const name = parseStackLine(line); + if (name && name !== 'logMessage') { + return name; + } + } + + return 'unknown function'; } /**