Showing 9 of 9 total issues

Function Ably has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

var Ably = function Ably(namespace) {
    var self = this;

    function relayPendingSubscribers(test) {
        var unmatchedSubscribers = [],
Severity: Minor
Found in src/ably.js - About 4 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 Ably has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var Ably = function Ably(namespace) {
    var self = this;

    function relayPendingSubscribers(test) {
        var unmatchedSubscribers = [],
Severity: Major
Found in src/ably.js - About 3 hrs to fix

    Function defaultSampler has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        default: function defaultSampler(variants) {
            return function() {
                var total = 0,
                    current = 0,
                    random,
    Severity: Minor
    Found in src/samplers.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

    Function purgeOldExpositions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    ExpositionManager.prototype.purgeOldExpositions = function purgeOldExpositions(scope, cutoffDate) {
        var data = scope.load();
        if (data === null) {
            return;
        }
    Severity: Minor
    Found in src/exposition-manager.js - About 1 hr 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 Test has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var Test = function Test(options) {
        var self = this;
    
        function notifySubscribers() {
            var subscriber;
    Severity: Minor
    Found in src/test.js - About 1 hr to fix

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

      ExpositionManager.prototype.purgeOldExpositions = function purgeOldExpositions(scope, cutoffDate) {
          var data = scope.load();
          if (data === null) {
              return;
          }
      Severity: Minor
      Found in src/exposition-manager.js - About 1 hr to fix

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

            default: function defaultSampler(variants) {
                return function() {
                    var total = 0,
                        current = 0,
                        random,
        Severity: Minor
        Found in src/samplers.js - About 1 hr to fix

          Function Test has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          var Test = function Test(options) {
              var self = this;
          
              function notifySubscribers() {
                  var subscriber;
          Severity: Minor
          Found in src/test.js - About 45 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

          Avoid too many return statements within this function.
          Open

              return expositions[test];
          Severity: Major
          Found in src/exposition-manager.js - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language