dareid/chakram

View on GitHub

Showing 7 of 42 total issues

Function testChainedCompriseProperty has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        var testChainedCompriseProperty = function(description, buildChain) {
            describe(description, function () {
                it("should ensure body includes given json", function() {
                    return chakram.waitFor([
                        buildChain(expect(postRequest).to).json({
Severity: Minor
Found in test/assertions/json.js - About 1 hr to fix

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

    module.exports = function (chai, utils) {
    
        var getCookie = function (jar, url, key) {
            var cookies = jar.getCookies(url);
            for(var ct = 0; ct < cookies.length; ct++) {
    Severity: Minor
    Found in lib/assertions/cookie.js - About 1 hr to fix

      Function exports has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function (chai, utils) {
      
        var chakram = require('./../chakram');
      
        utils.addMethod(chai.Assertion.prototype, 'schema', function () {
      Severity: Minor
      Found in lib/assertions/schema.js - About 1 hr to fix

        Function request has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.request = function (method, url, params) {
            var options = extend({
                url: url,
                method: method,
                json: true
        Severity: Minor
        Found in lib/methods.js - About 1 hr to fix

          Function testWriteMethods has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var testWriteMethods = function (testMethod, testUrl) {
                  it("should support JSON requests", function () {
                      var json = {"num": 2,"str": "test"};
                      var response = testMethod(testUrl, json);
                      return response.then(function(resp) {
          Severity: Minor
          Found in test/core/methods.js - About 1 hr to fix

            Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function (chai, utils) {
            
                var getCookie = function (jar, url, key) {
                    var cookies = jar.getCookies(url);
                    for(var ct = 0; ct < cookies.length; ct++) {
            Severity: Minor
            Found in lib/assertions/cookie.js - About 35 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

            Function exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function (chai, utils) {
            
                utils.addMethod(chai.Assertion.prototype, 'header', function (key, expected) {
                    
                    var headerValue = this._obj.response.headers[key.toLowerCase()];
            Severity: Minor
            Found in lib/assertions/header.js - About 25 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