From f4707ebac1423bc158e5c4e9e7153df7dd261738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Mon, 16 Dec 2019 10:51:20 +0100 Subject: [PATCH] Fix two TODOs about irregular report.json format These were left to minimize report.json in earlier refactoring. Fixing them now should only affect the report.json structure but not report.html. --- lib/validator.js | 7 ++----- test/validator.js | 4 ++-- validate.js | 4 +--- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/validator.js b/lib/validator.js index 77ba6fcf..363ab010 100644 --- a/lib/validator.js +++ b/lib/validator.js @@ -186,16 +186,13 @@ const ashnazgHookUrls = [ ]; function validateAshHooks(hooks) { - // Note: unlike `reportError` used above, here empty object literals are - // pushed instead of nulls. This is simply to match the original structure - // of report.json. TODO: change this to null, or add error details. const errors = []; const ashHooks = hooks.filter(h => ashnazgHookUrls.includes(h.config.url) && h.config.contentType === "json" && h.config.insecureSsl === "0" && h.config.secret !== ""); if (ashHooks.length === 0) { - errors.push(['missingashnazghook', {}]); + errors.push(['missingashnazghook', null]); } if (ashHooks.length > 1) { - errors.push(['duplicateashnazghooks', {}]); + errors.push(['duplicateashnazghooks', null]); } return errors; } diff --git a/test/validator.js b/test/validator.js index d30460d0..fe546bce 100644 --- a/test/validator.js +++ b/test/validator.js @@ -411,7 +411,7 @@ describe('validateAshHooks', () => { it('no hooks', () => { const hooks = []; const errors = validateAshHooks(hooks); - assert.deepStrictEqual(errors, [['missingashnazghook', {}]]); + assert.deepStrictEqual(errors, [['missingashnazghook', null]]); }); it('one hook', () => { @@ -444,6 +444,6 @@ describe('validateAshHooks', () => { } }]; const errors = validateAshHooks(hooks); - assert.deepStrictEqual(errors, [['duplicateashnazghooks', {}]]); + assert.deepStrictEqual(errors, [['duplicateashnazghooks', null]]); }); }); diff --git a/validate.js b/validate.js index 41ebb5d2..f6450a08 100644 --- a/validate.js +++ b/validate.js @@ -81,9 +81,7 @@ async function validate() { groupRepos[gid].push({ name: r.name, fullName: fullName(r), - // Only include `hasRecTrack` in report.json if it's true. This is - // simply to match the original structure. TODO: include if false. - hasRecTrack: hasRecTrack ? true : undefined, + hasRecTrack, }); } if (repoData.ashRepo) {