Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// If file is null here look for a file name with the same basename
// And alter the target in the array
if (!file) {
target = path.basename(target);
for(var filename in data) {
if (path.basename(filename) === target) {
target = filename;
file = data[filename];
options.targets[index] = target;
break;
}
}
if (!file) {
console.warn("Unknown target file %s", target);
return;
}
}
var coverage = file.coverage();
var covered = coverage[0];
var partial = coverage[1];
var uncovered = coverage[2];
var dead = coverage[3];
var lines = covered + partial + uncovered + dead;
total.lines += lines;
total.covered += covered;
total.partial += partial;
total.uncovered += uncovered;
total.dead += dead;
});
console.debug('waitForSyncRepl', dbName, collName, shards, cinfo.shards, ccinfo);
var ok = true;
for (var i = 0; i < shards.length; ++i) {
if (cinfo.shards[shards[i]].length !== ccinfo[i].length) {
ok = false;
}
}
if (ok) {
console.debug('waitForSyncRepl: OK:', dbName, collName, shards);
return true;
}
require('internal').wait(1);
}
} catch (err) {
console.warn('waitForSyncRepl:', dbName, collName, ': exception', JSON.stringify(err));
}
console.warn('waitForSyncRepl:', dbName, collName, ': BAD');
return false;
}
var ok = true;
for (var i = 0; i < shards.length; ++i) {
if (cinfo.shards[shards[i]].length !== ccinfo[i].length) {
ok = false;
}
}
if (ok) {
console.debug('waitForSyncRepl: OK:', dbName, collName, shards);
return true;
}
require('internal').wait(1);
}
} catch (err) {
console.warn('waitForSyncRepl:', dbName, collName, ': exception', JSON.stringify(err));
}
console.warn('waitForSyncRepl:', dbName, collName, ': BAD');
return false;
}
forks: rep.forks,
forks_count: rep.forks_count,
description: rep.description || ' ',
open_issues_count: rep.open_issues_count,
stargazers_count: rep.stargazers_count,
created_at: rep.created_at,
language: rep.language
}
})
return resolve(peojects)
} catch (error) {
console.warn('github 控制器解析为 JSON 失败', body)
return reject(body)
}
} else {
console.warn('项目列表获取失败', 'err:', err, 'body:', body)
return reject(err)
}
})
})