silverbucket/teste

View on GitHub
lib/jaribu.js

Summary

Maintainability
F
5 days
Test Coverage

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

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

      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

        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 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 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 _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 run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function run(part, suiteIndex, testIndex) {
                        var local;
                        var o;
                        var isSuite = true;
                    
                    
                    Severity: Minor
                    Found in lib/jaribu.js - About 1 hr to fix

                      Avoid too many return statements within this function.
                      Open

                          return true;
                      Severity: Major
                      Found in lib/jaribu.js - About 30 mins to fix

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

                        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

                        Further Reading

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

                        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

                        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

                        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

                            } 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

                                  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

                        There are no issues that match your filters.

                        Category
                        Status