Skip to content

Commit

Permalink
Filter out empty strings (and add reminder)
Browse files Browse the repository at this point in the history
  • Loading branch information
tidoust authored and dontcallmedom committed Aug 23, 2024
1 parent 18be54c commit 7bd07aa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/reporting/file-issue-for-review.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ Usage notes for some of the options:
const currentBranch = execSync('git branch --show-current', execParams).trim();
console.log(`- current branch: ${currentBranch}`);

// Possibly useful reminder about calls to `filter` below:
// `split` on an empty string does not return an empty array!
console.log('How many issue files ought to be reported?');
const toadd = execSync('git diff --name-only --diff-filter=d issues/*.md', execParams).trim().split('\n');
const toadd = execSync('git diff --name-only --diff-filter=d issues/*.md', execParams)
.trim().split('\n').filter(x => !!x);
console.log(`- nb issue files to add/update: ${toadd.length}`);
const todelete = execSync('git diff --name-only --diff-filter=D issues/*.md', execParams).trim().split('\n');
const todelete = execSync('git diff --name-only --diff-filter=D issues/*.md', execParams)
.trim().split('\n').filter(x => !!x);
console.log(`- nb issue files to delete: ${todelete.length}`);
const toreport = toadd.map(name => { return { action: 'add', filename: name }; })
.concat(todelete.map(name => { return { action: 'delete', filename: name }; }))
Expand Down

0 comments on commit 7bd07aa

Please sign in to comment.