From 023b0c8c257e5ab095d512547e8884e88b1a6a41 Mon Sep 17 00:00:00 2001 From: Milan Lakhani Date: Mon, 8 Aug 2022 12:09:31 +0100 Subject: [PATCH] Catch when there is a misspelt filter in disabled_filters Signed-off-by: Milan Lakhani --- 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); });