Skip to content

Commit f4707eb

Browse files
committed
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.
1 parent d5a6085 commit f4707eb

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

lib/validator.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,13 @@ const ashnazgHookUrls = [
186186
];
187187

188188
function validateAshHooks(hooks) {
189-
// Note: unlike `reportError` used above, here empty object literals are
190-
// pushed instead of nulls. This is simply to match the original structure
191-
// of report.json. TODO: change this to null, or add error details.
192189
const errors = [];
193190
const ashHooks = hooks.filter(h => ashnazgHookUrls.includes(h.config.url) && h.config.contentType === "json" && h.config.insecureSsl === "0" && h.config.secret !== "");
194191
if (ashHooks.length === 0) {
195-
errors.push(['missingashnazghook', {}]);
192+
errors.push(['missingashnazghook', null]);
196193
}
197194
if (ashHooks.length > 1) {
198-
errors.push(['duplicateashnazghooks', {}]);
195+
errors.push(['duplicateashnazghooks', null]);
199196
}
200197
return errors;
201198
}

test/validator.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ describe('validateAshHooks', () => {
411411
it('no hooks', () => {
412412
const hooks = [];
413413
const errors = validateAshHooks(hooks);
414-
assert.deepStrictEqual(errors, [['missingashnazghook', {}]]);
414+
assert.deepStrictEqual(errors, [['missingashnazghook', null]]);
415415
});
416416

417417
it('one hook', () => {
@@ -444,6 +444,6 @@ describe('validateAshHooks', () => {
444444
}
445445
}];
446446
const errors = validateAshHooks(hooks);
447-
assert.deepStrictEqual(errors, [['duplicateashnazghooks', {}]]);
447+
assert.deepStrictEqual(errors, [['duplicateashnazghooks', null]]);
448448
});
449449
});

validate.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ async function validate() {
8181
groupRepos[gid].push({
8282
name: r.name,
8383
fullName: fullName(r),
84-
// Only include `hasRecTrack` in report.json if it's true. This is
85-
// simply to match the original structure. TODO: include if false.
86-
hasRecTrack: hasRecTrack ? true : undefined,
84+
hasRecTrack,
8785
});
8886
}
8987
if (repoData.ashRepo) {

0 commit comments

Comments
 (0)