krambuhl/Struck

View on GitHub

Showing 6 of 9 total issues

Function EventObject has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

Struck.EventObject = (function () {
  'use strict';

  var EventObject = Struck.BaseObject.extend();

Severity: Minor
Found in source/event-object.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 Intercom has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

Struck.Intercom = (function () {
  // setup default subscription object
  // used to clone and extend in `subscribe` function
  var defaultSubscription = {
    single: false,
Severity: Minor
Found in source/intercom.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 hook has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Struck.hook = (function () {
  var defaults = {
    prefix: 'on',
    pre: 'before',
    post: 'after',
Severity: Minor
Found in source/hook.js - About 1 hr to fix

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

      function removeListener(self, obj, events, func, context) {
        events = splitName(events);
    
        var rejects = [],
          passes = [];
    Severity: Minor
    Found in source/event-object.js - About 1 hr to fix

      Function BaseObject has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      Struck.BaseObject = (function () {
      
        // ####BaseObject Constructor
      
        // constructor is run when object is created
      Severity: Minor
      Found in source/base-object.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 removeListener has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        function removeListener(self, obj, events, func, context) {
      Severity: Minor
      Found in source/event-object.js - About 35 mins to fix
        Severity
        Category
        Status
        Source
        Language