Showing 107 of 107 total issues
Function readATClasspath
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
ATEnvironment.prototype.readATClasspath = function (classpath, callback) {
var classpathInfo = this._classpaths[classpath];
var self = this;
var filePath = null;
if (!classpathInfo) {
- 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 AriaTemplatesTests
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
var AriaTemplatesTests = function (campaign, inputConfig) {
// Default values for the config:
var testConfig = {
rootFolderPath: '/',
bootstrap: null,
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());
Similar blocks of code found in 2 locations. Consider refactoring. Open
SlaveController.prototype.onSlaveIdle = function (slaveInfo) {
if (this.socket) {
this.socket.write(JSON.stringify({
type: "slaveIdle",
slaveId: slaveInfo.slaveId
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 70.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
SlaveController.prototype.onSlaveBusy = function (slaveInfo) {
if (this.socket) {
this.socket.write(JSON.stringify({
type: "slaveBusy",
slaveId: slaveInfo.slaveId
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 70.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 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 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 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 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 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 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 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({