Showing 66 of 66 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (o.obj.parent !== undefined) {
pub.details('suite', o.obj.parent);
pub.details(o.name, o.obj);
} else {
pub.details('suite', o.obj);
- 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 79.
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 pass
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function pass(part, suiteIndex, testIndex) {
var o;
var isSuite = false;
if (typeof testIndex === 'number') {
Similar blocks of code found in 2 locations. Consider refactoring. Open
var HttpServer = function (cfg) {
if (typeof cfg.port === 'number') {
this.port = cfg.port;
}
if (typeof cfg.uris === 'object') {
- 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 77.
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
var WebSocketClient = function (cfg) {
if (typeof cfg.url === 'string') {
this.url = cfg.url;
}
if (typeof cfg.type === 'string') {
- 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 77.
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
ret.fail(function (err) {
var stack;
if (err.hasOwnProperty('stack')) {
stack = err.stack;
} else {
- 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 74.
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
} else {
display.printn(c.greenbg + ' OK ' + c.reset + c.green +
' all tests passed!' + c.reset);
if (typeof process !== 'undefined') {
process.exit(0);
- 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 74.
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
function (err) {
var stack;
if (err.hasOwnProperty('stack')) {
stack = err.stack;
} else {
- 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 74.
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
((summary.scaffolding.failed > 0) || (summary.scaffolding.failed > 0))) {
display.printn(c.redbg + ' FAIL' + c.reset + c.red +
' some tests failed!' + c.reset);
if (typeof process !== 'undefined') {
process.exit(1);
- 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 74.
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 executeTest
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function executeTest(part, local, suiteIndex, testIndex) {
//
// we run the test in the next tick so that the function returns and
// we don't build up the call stack
//
Function run
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Throws.prototype.run = function (func, expected, message) {
if (typeof func !== 'function') {
throw new Error('throws takes at least one parameter, a function to run.');
}
Function buildTestObj
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildTestObj(env, s, t) {
if (! t.desc ) {
err_msg = s.name + ": test '" + t.name +
"'' requires a 'desc' property";
return false;
Function run
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
WebSocketServer.prototype.run = function (callback) {
var WebSocketServer = require('websocket').server;
var http = requirejs('http');
var messages = this.messages;
var port = this.port;
Function loadSuite
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
pub.loadSuite = function (s) {
if (! s.desc ) {
err_msg = '... suite requires a \'desc\' property';
return false;
} else if (! s.tests ) {
Function waitResult
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function waitResult(part, suiteIndex, testIndex, local) {
// this is function calls itself after a set interval, checking the
// status of the test via. the result property.
// result is initialized as undefined, and the test is not complete
// until it is 'true' or 'false'.
Function run
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
HttpServer.prototype.run = function (callback) {
var key;
var express = requirejs('express');
var bodyParser = requirejs('body-parser');
Function json
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
json: (function () {
var lPromise = (typeof Promise !== 'undefined') ? Promise : helpers.pub.fetch.Promise;
function status(response) {
if (response.status >= 200 && response.status < 300) {
Function _waitResult
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function _waitResult() {
if (processed) {
console.log('test processed, aborting waitResult');
return;
} else if (local.result() === undefined) {
Function getTestSummary
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getTestSummary(summary, suite) {
// iterate through tests for this suite, populating the summary
for (var i = 0, len = suite.tests.length; i < len; i++) {
var t = suite.tests[i];
var types = [ 'setup', 'takedown', 'beforeEach', 'afterEach' ];
Function assert
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
pub.assert = function (one, two, customMsg) {
customMsg = customMsg ? (' -- ' + customMsg) : '';
var args = Array.prototype.slice.call(arguments);
var self = arguments.callee;
if (typeof one === 'undefined') {
Function browser
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
browser: function (summary) {
var i, o;
var failedScaffoldingLength = summary.scaffolding.failObjs.length;
if (failedScaffoldingLength > 0) {
__browserWrite("<br />failed scaffolding:");