File jaribu.js
has 496 lines of code (exceeds 250 allowed). Consider refactoring. Open
if (typeof define !== 'function') {
var define = require('amdefine')(module);
}
define([ 'jaribu/colors', 'jaribu/display', 'jaribu/tools/Env',
Function fail
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fail(part, suiteIndex, testIndex, msg) {
if (typeof testIndex === 'string') {
msg = testIndex;
testIndex = undefined;
}
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') {
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 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 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 _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 run
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function run(part, suiteIndex, testIndex) {
var local;
var o;
var isSuite = true;
Avoid too many return
statements within this function. Open
return true;
Similar blocks of code found in 2 locations. Consider refactoring. Open
for (var i = 0, len = types.length; i < len; i++) {
if (typeof suite[types[i]].status === 'undefined') {
summary.scaffolding.skipped = summary.scaffolding.skipped + 1;
} else if (!suite[types[i]].status) {
summary.scaffolding.failed = summary.scaffolding.failed + 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 203.
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
for (var j = 0, jlen = types.length; j < jlen; j++) {
if (typeof t[types[j]].status === 'undefined') {
summary.scaffolding.skipped =
summary.scaffolding.skipped + 1;
} else if (!t[types[j]].status) {
- 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 203.
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
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
} 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
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