Fix timeLabel regex to match decimal values like "45.5 sec"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 21:05:27 +08:00
parent d0da9e875e
commit d47d03c3be

View File

@@ -523,7 +523,7 @@ function timeLabel(time) {
// sonar-qube prevent super-linear runtime due to backtracking; change * to ? // sonar-qube prevent super-linear runtime due to backtracking; change * to ?
// //
const label = getTimeLabel(time).replace(/\s+/g, " "); // Collapse all consecutive whitespace into a single space const label = getTimeLabel(time).replace(/\s+/g, " "); // Collapse all consecutive whitespace into a single space
const result = label.match(/^(\d+)\s?([a-zA-Z]+)$/); // add ^ and $ to meet sonar-qube need const result = label.match(/^([\d.]+)\s?([a-zA-Z]+)$/); // add ^ and $ to meet sonar-qube need
return result; return result;
} }