Skip to content

Commit 6fd552e

Browse files
committed
Catch when there is a misspelt filter in disabled_filters
1 parent 6ebab5f commit 6fd552e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tools/validateLandscape.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ async function main() {
3737
'extra'
3838
];
3939

40+
const filters = [
41+
'category',
42+
'project',
43+
'license',
44+
'organization',
45+
'headquarters',
46+
'company type',
47+
'industry'
48+
];
49+
4050
const addKeyError = (title, key) => {
4151
hasInvalidKeys = true;
4252
errors.push(`${title} has an unknown key: ${key}`);
@@ -180,6 +190,12 @@ async function main() {
180190
}
181191
}
182192

193+
const disabledFilters = settings.big_picture.main.disabled_filters || [];
194+
const nonExistentFilter = disabledFilters.find(filter => !(filters.includes(filter.toLowerCase())));
195+
if (nonExistentFilter) {
196+
errors.push(`"${nonExistentFilter}" is included in disabled_filters but is not a recognised filter`);
197+
}
198+
183199
errors.forEach(function(error) {
184200
setFatalError(error);
185201
});

0 commit comments

Comments
 (0)