From 6fd552eb246f9e84c9c3ea9ed6a2c659216c80d9 Mon Sep 17 00:00:00 2001 From: Milan Lakhani Date: Tue, 2 Aug 2022 15:23:37 +0100 Subject: [PATCH] Catch when there is a misspelt filter in disabled_filters --- tools/validateLandscape.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/validateLandscape.js b/tools/validateLandscape.js index e1010acb..b7e682cf 100644 --- a/tools/validateLandscape.js +++ b/tools/validateLandscape.js @@ -37,6 +37,16 @@ async function main() { 'extra' ]; + const filters = [ + 'category', + 'project', + 'license', + 'organization', + 'headquarters', + 'company type', + 'industry' + ]; + const addKeyError = (title, key) => { hasInvalidKeys = true; errors.push(`${title} has an unknown key: ${key}`); @@ -180,6 +190,12 @@ async function main() { } } + const disabledFilters = settings.big_picture.main.disabled_filters || []; + const nonExistentFilter = disabledFilters.find(filter => !(filters.includes(filter.toLowerCase()))); + if (nonExistentFilter) { + errors.push(`"${nonExistentFilter}" is included in disabled_filters but is not a recognised filter`); + } + errors.forEach(function(error) { setFatalError(error); });