betajs/betajs-compile

View on GitHub
grunt/browserstack.js

Summary

Maintainability
D
2 days
Test Coverage

Function browserstack has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
Open

var browserstack = function (compatability, desktop, mobile, flash) {
    var result = [];
    for (var key in compatability) {
        var value = compatability[key].toLowerCase();
        var versions = value.replace(/\s/g, '').split("-");
Severity: Minor
Found in grunt/browserstack.js - About 1 day 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 browserstack has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var browserstack = function (compatability, desktop, mobile, flash) {
    var result = [];
    for (var key in compatability) {
        var value = compatability[key].toLowerCase();
        var versions = value.replace(/\s/g, '').split("-");
Severity: Major
Found in grunt/browserstack.js - About 2 hrs to fix

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

    module.exports = function (taskname, tests, options) {
        this.grunt.loadNpmTasks('grunt-template');
        this.grunt.loadNpmTasks('grunt-shell');
        this.grunt.loadNpmTasks('grunt-contrib-clean');
        options = options || {};
    Severity: Minor
    Found in grunt/browserstack.js - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                          if (mapped.device_map && mapped.device_map[current])
                              mob.device = mapped.device_map[current];
      Severity: Major
      Found in grunt/browserstack.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if (mapped.extend_map && mapped.extend_map[current])
                                result.push(mapped.extend_map[current]);
                            else
                                result.push(name + "_" + current);
        Severity: Major
        Found in grunt/browserstack.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if (mapped.real_mobile && current in mapped.real_mobile)
                                  mob.real_mobile = mapped.real_mobile[current];
          Severity: Major
          Found in grunt/browserstack.js - About 45 mins to fix

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

            module.exports = function (taskname, tests, options) {
                this.grunt.loadNpmTasks('grunt-template');
                this.grunt.loadNpmTasks('grunt-shell');
                this.grunt.loadNpmTasks('grunt-contrib-clean');
                options = options || {};
            Severity: Minor
            Found in grunt/browserstack.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

            There are no issues that match your filters.

            Category
            Status