kai-jacobsen/kontentblocks

View on GitHub

Showing 398 of 4,293 total issues

Module has 33 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Module implements EntityInterface, FieldEntityInterface
{

    /**
     * Module Properties Object
Severity: Minor
Found in core/Modules/Module.php - About 4 hrs to fix

    Function onAdd has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          onAdd: function(map) {
            var className = 'leaflet-control-geocoder',
              container = L.DomUtil.create('div', className + ' leaflet-bar'),
              icon = L.DomUtil.create('button', className + '-icon', container),
              form = (this._form = L.DomUtil.create('div', className + '-form', container)),
    Severity: Major
    Found in js/third-party/leaflet-geocoder.js - About 4 hrs to fix

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

      var Utilities = function ($) {
        return {
          // store with expiration
          stex: {
            set: function (key, val, exp) {
      Severity: Minor
      Found in js/src/common/Utilities.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 localize has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function localize()
          {
              //Caps for the current user as global js object
      
              $current_user = wp_get_current_user();
      Severity: Minor
      Found in core/Hooks/Enqueues.php - 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 restoreBackup has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          public function restoreBackup($backupId)
          {
              if (!apply_filters('kb.backups.enabled', '__return_true')) {
                  return false;
              }
      Severity: Minor
      Found in core/Backend/Storage/BackupDataStorage2.php - 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 onAdd has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          onAdd: function(map) {
            var className = 'leaflet-control-geocoder',
              container = L.DomUtil.create('div', className + ' leaflet-bar'),
              icon = L.DomUtil.create('button', className + '-icon', container),
              form = (this._form = L.DomUtil.create('div', className + '-form', container)),
      Severity: Major
      Found in js/third-party/leaflet.js - About 3 hrs to fix

        Function filterForPost has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            public function filterForPost(PostEnvironment $environment)
            {
        
                $pageTemplate = $environment->getPageTemplate();
                $postType = $environment->getPostType();
        Severity: Minor
        Found in core/Areas/AreaRegistry.php - 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

        Utilities has 30 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Utilities
        {
        
            protected static $postEnvironments = array();
            protected static $termEnvironments = array();
        Severity: Minor
        Found in core/Utils/Utilities.php - About 3 hrs to fix

          Function fillArrayWithFileNodes has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              public function fillArrayWithFileNodes($dir, $root)
              {
                  $data = array();
                  $dir = new DirectoryIterator($dir);
                  foreach ($dir as $node) {
          Severity: Minor
          Found in core/Modules/ModuleViewFilesystem.php - 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

          File StandardFieldSection.php has 315 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace Kontentblocks\Fields;
          
          use Exception;
          Severity: Minor
          Found in core/Fields/StandardFieldSection.php - About 3 hrs to fix

            File DynamicAreas.php has 313 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace Kontentblocks\Backend\Dynamic;
            
            use Kontentblocks\Areas\AreaProperties;
            Severity: Minor
            Found in core/Backend/Dynamic/DynamicAreas.php - About 3 hrs to fix

              StandardFieldSection has 29 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class StandardFieldSection implements ExportableFieldInterface
              {
              
                  /**
                   * Preset defaults
              Severity: Minor
              Found in core/Fields/StandardFieldSection.php - About 3 hrs to fix

                File Module.php has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                namespace Kontentblocks\Modules;
                
                
                
                Severity: Minor
                Found in core/Modules/Module.php - About 3 hrs to fix

                  File kontentblocks.php has 304 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /*
                    Plugin Name: Kontentblocks
                    Plugin URI: https://github.com/kai-jacobsen/kontentblocks
                    Description: Content modularization framework
                  Severity: Minor
                  Found in kontentblocks.php - About 3 hrs to fix

                    Method registerScripts has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function registerScripts()
                        {
                            $folder = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? 'dev' : 'dist';
                            $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
                            $version = Kontentblocks::VERSION;
                    Severity: Major
                    Found in core/Hooks/Enqueues.php - About 3 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 render has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          render: function (reload) {
                            var that = this,
                              json;
                            Logger.User.info('Frontend modal retrieves data from the server');
                            json = this.model.toJSON();
                        Severity: Major
                        Found in js/src/frontend/Views/EditModalModules.js - About 3 hrs to fix

                          File Enqueues.php has 300 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          
                          namespace Kontentblocks\Hooks;
                          
                          use Kontentblocks\Kontentblocks;
                          Severity: Minor
                          Found in core/Hooks/Enqueues.php - About 3 hrs to fix

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

                              init: function (modalView) {
                                if (!wp || !wp.media) {
                                  return;
                                }
                            
                            
                            Severity: Major
                            Found in js/src/fields/controls/KB.Plupload.js - About 3 hrs to fix

                              exports has 26 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              module.exports = Backbone.View.extend({
                                tagName: 'div',
                                id: 'onsite-modal',
                                timerId: null,
                                viewStack: {},
                              Severity: Minor
                              Found in js/src/frontend/Views/EditModalModules.js - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language