mirror of https://github.com/espruino/BangleApps
add line numbers for loadWidgets error message, and provide a way to ignore messages we know about
parent
b9fb9f0eab
commit
425930f2ec
|
@ -30,7 +30,11 @@ function ERROR(msg, opt) {
|
|||
function WARN(msg, opt) {
|
||||
// file=app.js,line=1,col=5,endColumn=7
|
||||
opt = opt||{};
|
||||
console.log(`::warning${Object.keys(opt).length?" ":""}${Object.keys(opt).map(k=>k+"="+opt[k]).join(",")}::${msg}`);
|
||||
if (KNOWN_WARNINGS.includes(msg)) {
|
||||
console.log(`Known warning : ${msg}`);
|
||||
} else {
|
||||
console.log(`::warning${Object.keys(opt).length?" ":""}${Object.keys(opt).map(k=>k+"="+opt[k]).join(",")}::${msg}`);
|
||||
}
|
||||
warningCount++;
|
||||
}
|
||||
|
||||
|
@ -86,6 +90,10 @@ const INTERNAL_FILES_IN_APP_TYPE = { // list of app types and files they SHOULD
|
|||
'waypoints' : ['waypoints'],
|
||||
// notify?
|
||||
};
|
||||
/* These are warnings we know about but don't want in our output */
|
||||
var KNOWN_WARNINGS = [
|
||||
"App gpsrec data file wildcard .gpsrc? does not include app ID"
|
||||
];
|
||||
|
||||
function globToRegex(pattern) {
|
||||
const ESCAPE = '.*+-?^${}()|[]\\';
|
||||
|
@ -230,7 +238,7 @@ apps.forEach((app,appIdx) => {
|
|||
var a = fileContents.indexOf("Bangle.loadWidgets()");
|
||||
var b = fileContents.indexOf("Bangle.setUI(");
|
||||
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});
|
||||
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});
|
||||
}
|
||||
}
|
||||
for (const key in file) {
|
||||
|
|
Loading…
Reference in New Issue