MrBoolean/http-test

View on GitHub

Showing 12 of 22 total issues

Function suiteTestSuite has 148 lines of code (exceeds 25 allowed). Consider refactoring.
Open

describe('http-test/suite', function suiteTestSuite() {
  it('inherits from `Base`', function inheritsFromBaseTest() {
    (new Suite()).should.be.an.instanceOf(Base);
  });

Severity: Major
Found in test/suite.test.js - About 5 hrs to fix

    Function validate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function validate(item) {
      var index;
      var current;
      var thresholds;
      var result = {
    Severity: Minor
    Found in util/validate.js - About 2 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

    Function baseTestSuite has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    describe('http-test/base', function baseTestSuite() {
      describe('#constructor', function constructorTestSuite() {
        it('applies `options.req` with the property `req`', function appliesTheReqOptionsTest() {
          var base = new Base({ req: { baseUrl: 'http://www.google.com' } });
          base.req.baseUrl.should.equal('http://www.google.com');
    Severity: Minor
    Found in test/base.test.js - About 2 hrs to fix

      Function functionalTestSuite has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        describe('functional testing', function functionalTestSuite() {
          var baseUrl = 'http://www.http-test.com';
          var mock;
      
          beforeEach(function runBeforeEach() {
      Severity: Minor
      Found in test/suite.test.js - About 1 hr to fix

        Function run has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Suite.prototype.run = function run() {
          var suite = this;
          var offAny = [];
        
          function broadcast(test) {
        Severity: Minor
        Found in suite.js - About 1 hr to fix

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

          describe('http-test/test', function testTestSuite() {
            it('inherits from `Base`', function inheritsFromBaseTest() {
              (new Test()).should.be.an.instanceOf(Base);
            });
          
          
          Severity: Minor
          Found in test/test.test.js - About 1 hr to fix

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

            module.exports = function validate(item) {
              var index;
              var current;
              var thresholds;
              var result = {
            Severity: Minor
            Found in util/validate.js - About 1 hr to fix

              Function validateTestSuite has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              describe('http-test/util/validate', function validateTestSuite() {
                it('marks the test as "invalid" if a error is provided', function provideErrTest() {
                  var result = validate({ err: new Error() });
              
                  result.status.should.equal('invalid');
              Severity: Minor
              Found in test/util/validate.test.js - About 1 hr to fix

                Function thresholdTestSuite has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  describe('#threshold', function thresholdTestSuite() {
                    it('requires at least one argument (ms)', function atLeastOneArgumentTest() {
                      (function shouldThrow() {
                        var test = new Base();
                        test.threshold();
                Severity: Minor
                Found in test/base.test.js - About 1 hr to fix

                  Function run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Test.prototype.run = function run() {
                    var test = this;
                  
                    var current = {
                      spec: merge({}, test.spec || {}, test.suite.spec || {}),
                  Severity: Minor
                  Found in test.js - About 1 hr to fix

                    Function addTestSuite has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      describe('#add', function addTestSuite() {
                        it('accepts a string', function stringTest() {
                          var suite = new Suite();
                    
                          suite.add('http://www.google.com');
                    Severity: Minor
                    Found in test/suite.test.js - About 1 hr to fix

                      Function hasListener has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Suite.prototype.hasListener = function hasListener(name, callback) {
                        var affected = this._ee._events[name];
                        var index;
                      
                        if (!affected) {
                      Severity: Minor
                      Found in suite.js - About 55 mins 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

                      Severity
                      Category
                      Status
                      Source
                      Language