silverbucket/jaribu

View on GitHub

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);
Severity: Major
Found in lib/display.js and 1 other location - About 2 hrs to fix
lib/display.js on lines 336..341

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

Further Reading

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') {
Severity: Major
Found in lib/jaribu.js - About 2 hrs to fix

    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') {
    Severity: Major
    Found in lib/tools/HttpServer.js and 1 other location - About 2 hrs to fix
    lib/tools/WebSocketClient.js on lines 35..42

    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

    Further Reading

    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') {
    Severity: Major
    Found in lib/tools/WebSocketClient.js and 1 other location - About 2 hrs to fix
    lib/tools/HttpServer.js on lines 36..43

    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

    Further Reading

    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 {
    Severity: Major
    Found in lib/jaribu.js and 1 other location - About 1 hr to fix
    lib/jaribu.js on lines 484..492

    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

    Further Reading

    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);
    Severity: Major
    Found in lib/jaribu.js and 1 other location - About 1 hr to fix
    lib/jaribu.js on lines 664..670

    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

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                function (err) {
                  var stack;
                  if (err.hasOwnProperty('stack')) {
                    stack = err.stack;
                  } else {
    Severity: Major
    Found in lib/jaribu.js and 1 other location - About 1 hr to fix
    lib/jaribu.js on lines 498..506

    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

    Further Reading

    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);
    Severity: Major
    Found in lib/jaribu.js and 1 other location - About 1 hr to fix
    lib/jaribu.js on lines 670..676

    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

    Further Reading

    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
        //
    Severity: Minor
    Found in lib/jaribu.js - About 1 hr to fix

      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.');
          }
      
      
      Severity: Minor
      Found in lib/tools/Throws.js - About 1 hr to fix

        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;
        Severity: Minor
        Found in lib/jaribu.js - About 1 hr to fix

          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;
          Severity: Minor
          Found in lib/tools/WebSocketServer.js - About 1 hr to fix

            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 ) {
            Severity: Minor
            Found in lib/jaribu.js - About 1 hr to fix

              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'.
              Severity: Minor
              Found in lib/jaribu.js - About 1 hr to fix

                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');
                
                
                Severity: Minor
                Found in lib/tools/HttpServer.js - About 1 hr to fix

                  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) {
                  Severity: Minor
                  Found in lib/Scaffolding.js - About 1 hr to fix

                    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)  {
                    Severity: Minor
                    Found in lib/jaribu.js - About 1 hr to fix

                      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' ];
                      Severity: Minor
                      Found in lib/jaribu.js - About 1 hr to fix

                        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') {
                        Severity: Minor
                        Found in lib/tools/assert.js - About 1 hr to fix

                          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:");
                          Severity: Minor
                          Found in lib/display.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language