kai-jacobsen/kontentblocks

View on GitHub
js/src/common/UI.js

Summary

Maintainability
D
1 day
Test Coverage

Function initSortable has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  initSortable: function ($cntxt) {
    var $context = $cntxt || jQuery('body');
    var currentModule, areaOver, prevAreaOver;
    var validModule = false;

Severity: Minor
Found in js/src/common/UI.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 initSortable has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  initSortable: function ($cntxt) {
    var $context = $cntxt || jQuery('body');
    var currentModule, areaOver, prevAreaOver;
    var validModule = false;

Severity: Major
Found in js/src/common/UI.js - About 4 hrs to fix

    File UI.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     *
     * These is a collection of helper functions to handle
     * the user interface / user interaction such as
     * - Sorting
    Severity: Minor
    Found in js/src/common/UI.js - About 3 hrs to fix

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

        metaBoxReorder: function (e, o, settings, action) {
          if (settings.data) {
            var a = settings.data;
      
            if (a && a.split) {
      Severity: Minor
      Found in js/src/common/UI.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 update has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            update: function (ev, ui) {
              if (!isValidModule()) {
                return false;
              }
      
      
      Severity: Minor
      Found in js/src/common/UI.js - About 1 hr to fix

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

          init: function () {
            var that = this;
            var $body = $('body');
            // init general ui components
            this.initTabs();
        Severity: Minor
        Found in js/src/common/UI.js - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status