Showing 87 of 107 total issues
Function TestServer
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
var TestServer = function (config, logger) {
this.logger = new Logger("TestServer", logger);
this.config = config;
var app = connect();
app.use(compression());
Function iterate
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
FileSet.prototype.iterate = function (entryCallback, endCallback) {
var self = this;
var root = this._root || "";
var waitingCallbacks = 0;
var decreaseCallbacks = function () {
Function cleanTaskEnd
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function cleanTaskEnd() {
try {
mainTestObject.$dispose();
mainTestObject = null;
} catch (e) {
Function merge
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
var merge = function (destination, source, exclude) {
if (!source) {
return;
}
if (!exclude) {
- 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 addToFlatReport
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function addToFlatReport(task) {
var subTests = task.subTests;
/*if (task.errors) {
// don't loose those errors
}*/
- 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 39 lines of code (exceeds 25 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!!
Function createPhantomExitCb
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
createPhantomExitCb: function (cfg, state, n) {
// Node 0.8 and 0.10 differently handle spawning errors ('exit' vs 'error'), but errors that happened after
// launching the command are both handled in 'exit' callback
return function (code, signal) {
// See http://tldp.org/LDP/abs/html/exitcodes.html and http://stackoverflow.com/a/1535733/
Function reportsList
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
reportsList: function (callback) {
var possibleReports = listsPossibleReports();
var now = new Date();
var waitingCb = 1;
var callCallback = function () {
Function exports
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (grunt) {
grunt.initConfig({
jshint: {
lib: ['package.json', 'gruntfile.js', 'lib/**/*.js', '!lib/**/html5shiv.js'],
options: grunt.file.readJSON('.jshintrc'),
Function assignTask
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Slave.prototype.assignTask = function (campaign, task) {
var taskExecutionId = this.taskExecutionId = ++taskExecutionCount;
this.currentTask = task;
this.currentCampaign = campaign;
this.currentTaskRestartPlanned = false;
Function TestCampaign
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
var TestCampaign = function (config, parentLogger) {
this.results = config.liveResults ? [] : null;
this.startTime = new Date();
this.campaignNumber = config.campaignNumber;
this.id = createCampaignId(this.startTime);
- 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 instrument
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Coverage.prototype.instrument = function (absoluteFileName, displayFileName, callback) {
var self = this;
var cacheEntry = this._cache[displayFileName];
if (cacheEntry) {
if (cacheEntry.callbacks) {
Function init
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
AllTests.prototype.init = function (callback) {
var expectedCallbacks = 1;
var testTypes = this.testTypes;
var decrementExpectedCallbacks = function () {
expectedCallbacks--;
Function readATOldFileContent
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function readATOldFileContent(res, fileContent, fileName) {
var classDef = null;
var classDefinitionCalls = 0;
var sandbox = {
aria: {
Function onInitialized
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
page.onInitialized = function (arg1) {
page.evaluate(function () {
window.attesterConfig = {
onDisconnect: function () {
window.callPhantom({
Function readATFile
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
ATEnvironment.prototype.readATFile = function (file, callback) {
file = path.normalize(file);
var fileInfo = this._files[file];
if (!fileInfo) {
var waitingCallbacks = [callback];
Function sendTestUpdate
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
var sendTestUpdate = function (scope, name, info) {
if (!checkTaskExecutionId(scope, name)) {
return false;
}
if (!info) {
Function buildTask
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
var buildTask = function (testType, test, browser) {
var taskId = this.tasks.length;
var task = {
taskId: taskId,
testType: testType,
Function processFile
has 33 lines of code (exceeds 25 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;
Function taskFinished
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
taskFinished: function (event) {
var taskId = event.taskId;
var task = this.campaign.jsonReport.tasks[taskId];
var taskName = task.name;