mirror of https://github.com/espruino/BangleApps
sanitycheck: warn on boolean-formatters
parent
d646e04b42
commit
6e3066d444
|
@ -256,10 +256,18 @@ apps.forEach((app,appIdx) => {
|
||||||
if (a>=0 && b>=0 && a<b)
|
if (a>=0 && b>=0 && a<b)
|
||||||
WARN(`Clock ${app.id} file calls loadWidgets before setUI (clock widget/etc won't be aware a clock app is running)`, {file:appDirRelative+file.url, line : fileContents.substr(0,a).split("\n").length});
|
WARN(`Clock ${app.id} file calls loadWidgets before setUI (clock widget/etc won't be aware a clock app is running)`, {file:appDirRelative+file.url, line : fileContents.substr(0,a).split("\n").length});
|
||||||
}
|
}
|
||||||
// if settings, suggest adding to datafiles
|
// if settings
|
||||||
if (/\.settings?\.js$/.test(file.name) && (!app.data || app.data.every(d => !d.name || !d.name.endsWith(".json")))) {
|
if (/\.settings?\.js$/.test(file.name)) {
|
||||||
|
// suggest adding to datafiles
|
||||||
|
if (!app.data || app.data.every(d => !d.name || !d.name.endsWith(".json"))) {
|
||||||
WARN(`App ${app.id} has a setting file but no corresponding data entry (add \`"data":[{"name":"${app.id}.settings.json"}]\`)`, {file:appDirRelative+file.url});
|
WARN(`App ${app.id} has a setting file but no corresponding data entry (add \`"data":[{"name":"${app.id}.settings.json"}]\`)`, {file:appDirRelative+file.url});
|
||||||
}
|
}
|
||||||
|
// check for manual boolean formatter
|
||||||
|
const m = fileContents.match(/format: *\(\) *=>.*["']Yes["']/);
|
||||||
|
if (m) {
|
||||||
|
WARN(`Settings for ${app.id} has a boolean formatter - this is handled automatically, the line can be removed`, {file:appDirRelative+file.url, line: fileContents.substr(0, m.index).split("\n").length});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (const key in file) {
|
for (const key in file) {
|
||||||
if (!STORAGE_KEYS.includes(key)) ERROR(`App ${app.id} file ${file.name} has unknown key ${key}`, {file:appDirRelative+file.url});
|
if (!STORAGE_KEYS.includes(key)) ERROR(`App ${app.id} file ${file.name} has unknown key ${key}`, {file:appDirRelative+file.url});
|
||||||
|
|
Loading…
Reference in New Issue