Skip to content

Commit 1985284

Browse files
Trotttargos
authored andcommitted
tools: use {N} for spaces in regex
Spaces are hard to count. Use {N} notation to indicate how many spaces in regular expressions in find-inactive-collaborators. PR-URL: #41295 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent d0d595f commit 1985284

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/find-inactive-collaborators.mjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const authors = await runGitCommand(
4949
// Get all approving reviewers of landed commits during the time period.
5050
const approvingReviewers = await runGitCommand(
5151
`git log --since="${SINCE}" | egrep "^ Reviewed-By: "`,
52-
(line) => /^ Reviewed-By: ([^<]+)/.exec(line)[1].trim()
52+
(line) => /^ {4}Reviewed-By: ([^<]+)/.exec(line)[1].trim()
5353
);
5454

5555
async function getCollaboratorsFromReadme() {
@@ -72,7 +72,7 @@ async function getCollaboratorsFromReadme() {
7272
foundCollaboratorHeading = true;
7373
}
7474
if (line.startsWith(' **') && isCollaborator) {
75-
const [, name, email] = /^ \*\*([^*]+)\*\* <<(.+)>>/.exec(line);
75+
const [, name, email] = /^ {2}\*\*([^*]+)\*\* <<(.+)>>/.exec(line);
7676
const mailmap = await runGitCommand(
7777
`git check-mailmap '${name} <${email}>'`
7878
);
@@ -136,7 +136,7 @@ async function moveCollaboratorToEmeritus(peopleToMove) {
136136
if (line.startsWith('* ')) {
137137
collaboratorFirstLine = line;
138138
} else if (line.startsWith(' **')) {
139-
const [, name, email] = /^ \*\*([^*]+)\*\* <<(.+)>>/.exec(line);
139+
const [, name, email] = /^ {2}\*\*([^*]+)\*\* <<(.+)>>/.exec(line);
140140
if (peopleToMove.some((entry) => {
141141
return entry.name === name && entry.email === email;
142142
})) {

0 commit comments

Comments
 (0)