Skip to content

Commit

Permalink
Catch when there is a misspelt filter in disabled_filters
Browse files Browse the repository at this point in the history
Signed-off-by: Milan Lakhani <[email protected]>
  • Loading branch information
milanlakhani committed Aug 8, 2022
1 parent 17c3b92 commit 023b0c8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tools/validateLandscape.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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);
});
Expand Down

0 comments on commit 023b0c8

Please sign in to comment.