Showing 87 of 107 total issues
Function exports
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (ipv4Only) {
var categories = {
IPv4: [],
internalIPv4: [],
IPv6: [],
Function tag
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function tag(name, defaults, description, scope, attributesGenerator) {
var config = defaults || {};
var data = scope || {};
merge(config, description);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function buildTasksForTest
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
var buildTasksForTest = function (testType, test) {
var subTests = test.subTests;
var testResults = test.results;
if (!subTests && !test.url && !testResults) {
// something is wrong with this test!!
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function optimizeNumberOfParallelInstances
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var optimizeNumberOfParallelInstances = function (cfg, logger) {
if (cfg.maxInstances === 0) { // explicitly asking for no PhantomJS
logger.logInfo("No PhantomJS instances launched.");
return 0;
}
Function resolvePath
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Resources.prototype.resolvePath = function (path, callback) {
var rootsArray = this._rootsArray;
var checkFileExistence = function (pathInContext, currentIndex) {
var entry = rootsArray[currentIndex];
var absolutePath = pathUtils.join(entry.root, pathInContext);
Function create
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.create = function (callback) {
testServer = new TestServer({
predictableUrls: config["predictable-urls"],
shutdownOnCampaignEnd: config["shutdown-on-campaign-end"],
frozen: config["server-only"],
Function routeCoverage
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
var routeCoverage = function (req, res, next) {
var testServer = this;
var match = /\/([0-9]+)\/([0-9]+)/.exec(req.path);
var campaignId;
var taskId;
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (req, res, next) {
var model = this.data;
var page = this.page;
if (page.charAt(0) !== "/") {
page = "/" + page;
Function _addResult
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
TestEnumerator.prototype._addResult = function (testInfo, res) {
var classpath = testInfo.name;
var testSuite = res.testSuite;
var error = res.error;
if (error) {
Function walker
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
var walker = new UglifyJS.TreeWalker(function (node) {
var isAssignment = node instanceof UglifyJS.AST_Assign && node.operator == "=";
if (!isAssignment) return;
var moduleExports = node.left;
var isDotExports = moduleExports instanceof UglifyJS.AST_Dot && moduleExports.property == "exports";
Function require
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exports.require = function (name, config) {
// Do it here so that it's available for the plugin even before it gets called
var pluginConfig = exports.config(name, config);
var pending = function () {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function init
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
AllTests.prototype.init = function (callback) {
var expectedCallbacks = 1;
var testTypes = this.testTypes;
var decrementExpectedCallbacks = function () {
expectedCallbacks--;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function processFile
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
var processFile = function processFile(out, fileName, fileInfos) {
fileName = fileName.replace(/\\/g, '/'); // use only forward slashes
out.push('SF:' + fileName);
var statements = fileInfos.code.src;
var execCount;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function readRequire
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function readRequire(expression) {
if (expression instanceof UglifyJS.AST_Call && expression.args.length == 1) {
var requireVar = expression.expression;
if (requireVar instanceof UglifyJS.AST_SymbolRef && requireVar.name == "require" && requireVar.thedef.undeclared) {
var param = expression.args[0];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function bootPhantom
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
bootPhantom: function (cfg, state, n) {
cfg.args = cfg.args || {};
var phantomPath = cfg.phantomPath;
var controlScript = pathUtil.join(__dirname, '../browsers/phantomjs-control-script.js');
Function init
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
TestCampaign.prototype.init = function (callback) {
// fills the array of tasks
var self = this;
var waitingCb = 1;
var endInit = function () {
Function stackTrace
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
attesterPrototype.stackTrace = function (exception) {
try {
var skipFirstLine = false;
if (!exception || !exception.stack) {
try {
Function getStatus
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
TestServer.prototype.getStatus = function () {
return {
slaves: this.slaves.map(function (slave) {
return {
address: slave.address,
Function exports
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (attesterServer, serverRoot) {
var listsPossibleReports = function () {
var list = [];
attesterServer.campaigns.forEach(function (campaign) {
var result = campaign.getCoverageResult();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function buildId
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
var buildId = function (loggersChain) {
var somethingBefore = false;
var leftParen = '['; // https://github.com/jshint/jshint/issues/1485
var res = [leftParen];
for (var i = 0, l = loggersChain.length; i < l; i++) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"