Skip to content

Commit

Permalink
tools: add verbose flag to find-inactive-collaborators
Browse files Browse the repository at this point in the history
PR-URL: #43964
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
Trott authored and danielleadams committed Aug 8, 2022
1 parent c0d2098 commit 091d015
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions tools/find-inactive-collaborators.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@
import cp from 'node:child_process';
import fs from 'node:fs';
import readline from 'node:readline';
import { parseArgs } from 'node:util';

const SINCE = process.argv[2] || '18 months ago';
const args = parseArgs({
allowPositionals: true,
options: { verbose: { type: 'boolean', short: 'v' } }
});

const verbose = args.values.verbose;
const SINCE = args.positionals[0] || '18 months ago';

async function runGitCommand(cmd, mapFn) {
const childProcess = cp.spawn('/bin/sh', ['-c', cmd], {
Expand Down Expand Up @@ -176,11 +183,12 @@ async function moveCollaboratorToEmeritus(peopleToMove) {
// Get list of current collaborators from README.md.
const collaborators = await getCollaboratorsFromReadme();

console.log(`Since ${SINCE}:\n`);
console.log(`* ${authors.size.toLocaleString()} authors have made commits.`);
console.log(`* ${approvingReviewers.size.toLocaleString()} reviewers have approved landed commits.`);
console.log(`* ${collaborators.length.toLocaleString()} collaborators currently in the project.`);

if (verbose) {
console.log(`Since ${SINCE}:\n`);
console.log(`* ${authors.size.toLocaleString()} authors have made commits.`);
console.log(`* ${approvingReviewers.size.toLocaleString()} reviewers have approved landed commits.`);
console.log(`* ${collaborators.length.toLocaleString()} collaborators currently in the project.`);
}
const inactive = collaborators.filter((collaborator) =>
!authors.has(collaborator.mailmap) &&
!approvingReviewers.has(collaborator.name)
Expand Down

0 comments on commit 091d015

Please sign in to comment.