power-assert-js/empower

View on GitHub

Showing 11 of 31 total issues

Function testWithOption has 343 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function testWithOption (option) {
    var assert = empower(baseAssert, fakeFormatter, option);


test('Bug reproduction. should not fail if argument is null Literal. ' + JSON.stringify(option), function () {
Severity: Major
Found in test/empower_test.js - About 1 day to fix

    File empower_test.js has 452 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    (function (root, factory) {
        'use strict';
    
        if (typeof define === 'function' && define.amd) {
            define(['empower', 'espower', 'acorn', 'acorn-es7-plugin', 'babel', 'escodegen', 'assert'], factory);
    Severity: Minor
    Found in test/empower_test.js - About 6 hrs to fix

      Function empower has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      function empower (assert, formatter, options) {
          var config = assign(defaultOptions(), options);
          var eagerEvaluation = !(config.modifyMessageOnRethrow || config.saveContextOnRethrow);
          // see: https://github.com/power-assert-js/empower/pull/26
          var shouldRecreateAssertionError = (function isStackUnchanged () {
      Severity: Minor
      Found in index.js - About 3 hrs to fix

      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

      File empower_option_test.js has 296 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      (function (root, factory) {
          'use strict';
          if (typeof define === 'function' && define.amd) {
              define(['empower', 'assert'], factory);
          } else if (typeof exports === 'object') {
      Severity: Minor
      Found in test/empower_option_test.js - About 3 hrs to fix

        Function testWithOption has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function testWithOption (option) {
            var assert = empower(baseAssert, fakeFormatter, option);
        
        
        test(JSON.stringify(option) + ' argument is null Literal.', function () {
        Severity: Major
        Found in test/not_espowered_case_test.js - About 2 hrs to fix

          Function empower has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function empower (assert, formatter, options) {
              var config = assign(defaultOptions(), options);
              var eagerEvaluation = !(config.modifyMessageOnRethrow || config.saveContextOnRethrow);
              // see: https://github.com/power-assert-js/empower/pull/26
              var shouldRecreateAssertionError = (function isStackUnchanged () {
          Severity: Major
          Found in index.js - About 2 hrs to fix

            Function sharedTestsForEmpowerFunctionReturnValue has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function sharedTestsForEmpowerFunctionReturnValue () {
                test('has ok method', function () {
                    assert.equal(typeof this.empoweredAssert.ok, 'function');
                });
                test('has _capt method', function () {
            Severity: Major
            Found in test/empower_option_test.js - About 2 hrs to fix

              Function onError has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function onError(e) {
                          try {
                              if (!e) {
                                  return done(new Error('Assertion Error should be thrown'));
                              }
              Severity: Minor
              Found in test/empower_test.js - About 1 hr to fix

                Function onError has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function onError(e) {
                            try {
                                if (!e) {
                                    return done(new Error('Assertion Error should be thrown'));
                                }
                Severity: Minor
                Found in test/empower_test.js - About 1 hr to fix

                  Function capturable has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function capturable () {
                      var events = [];
                  
                      function _capt (value, espath) {
                          events.push({value: value, espath: espath});
                  Severity: Minor
                  Found in lib/capturable.js - About 1 hr to fix

                    Function onError has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            onError: function onError (errorEvent) {
                                var e = errorEvent.error;
                                if (!/^AssertionError/.test(e.name)) {
                                    throw e;
                                }
                    Severity: Minor
                    Found in index.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language