From b90688cbc08e2bfc943c6eb608831c4cb97cccbb Mon Sep 17 00:00:00 2001 From: Phil Booth Date: Mon, 17 Sep 2018 13:00:06 +0100 Subject: [PATCH] feat(scripts): add an ignore file for the explain script Some of our existing stored procedures fail in the explain script but we don't want those failures to show up. In the future we may have reasons for wanting to ignore other procedures too. This change lets us ignore them while still running the script in CI. --- .explain-ignore | 4 ++++ scripts/explain-warn.js | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .explain-ignore diff --git a/.explain-ignore b/.explain-ignore new file mode 100644 index 0000000..a9d65cd --- /dev/null +++ b/.explain-ignore @@ -0,0 +1,4 @@ +accountEmails_4 +fetchVerificationReminders_2 +prune_7 +sessionWithDevice_15 diff --git a/scripts/explain-warn.js b/scripts/explain-warn.js index 8f7d895..16274c9 100755 --- a/scripts/explain-warn.js +++ b/scripts/explain-warn.js @@ -68,7 +68,9 @@ Mysql(log, require('../db-server').errors) .then(db => { return populateDatabase(db, 0) .then(() => { + const ignore = parseIgnoreFile() return getProcedureNames() + .filter(procedure => ! ignore.has(procedure)) .map(procedure => ({ procedure, path: getPath(procedure) @@ -272,6 +274,15 @@ function createAccountResetToken (db, uid, tokenId) { })) } +function parseIgnoreFile () { + return new Set( + fs.readFileSync('.explain-ignore', RETURN_STRING) + .split('\n') + .map(procedure => procedure.trim()) + .filter(procedure => !! procedure) + ) +} + function getProcedureNames () { return cp.execSync( // eslint-disable-next-line quotes