kai-jacobsen/kontentblocks

View on GitHub

Showing 398 of 4,293 total issues

Function getAdditionalClasses has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAdditionalClasses(Module $module)
    {
        $classes = array();

        $nextHash = null;
Severity: Minor
Found in core/Frontend/Renderer/AreaRenderer.php - About 2 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 kb-api.php has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Kontentblocks;

use function foo\func;
Severity: Minor
Found in includes/kb-api.php - About 2 hrs to fix

    AbstractEditableFieldReturn has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class AbstractEditableFieldReturn implements InterfaceFieldReturn, InterfaceEditableFieldReturn
    {
    
        /**
         * @var mixed
    Severity: Minor
    Found in core/Fields/Definitions/ReturnObjects/AbstractEditableFieldReturn.php - About 2 hrs to fix

      Function saveModules has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function saveModules($modules)
          {
      
              /** @var \Kontentblocks\Modules\Module $module */
              foreach ($modules as $module) {
      Severity: Minor
      Found in core/Backend/Environment/Save/SavePost.php - About 2 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 upscale has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

                  public function upscale($default, $orig_w, $orig_h, $dest_w, $dest_h, $crop)
                  {
                      if (!$crop) {
                          return null;
                      } // Let the wordpress default function handle this.
      Severity: Minor
      Found in core/Utils/ImageResize.php - About 2 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 compare has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          private function compare($first, $group = null, $groups, $value)
          {
              if (is_null($group)) {
                  $group = [
                      'start' => $first['day'],
      Severity: Minor
      Found in core/Fields/Definitions/ReturnObjects/OpeningTimesReturn.php - About 2 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 success has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            success: function (res) {
              // clear form content
              that.$inner.empty();
              // clear fields on ModuleView
              that.ModuleView.clearFields();
      Severity: Major
      Found in js/src/frontend/Views/EditModalModules.js - About 2 hrs to fix

        Kontentblocks has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        Class Kontentblocks
        {
        
            const VERSION = '0.12.3';
            const DEVMODE = true;
        Severity: Minor
        Found in kontentblocks.php - About 2 hrs to fix

          ModuleStorage has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class ModuleStorage implements \Countable
          {
              /**
               * current post id
               * @var int
          Severity: Minor
          Found in core/Backend/Storage/ModuleStorage.php - About 2 hrs to fix

            AreaRegistry has 21 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class AreaRegistry
            {
            
                /**
                 * All register areas
            Severity: Minor
            Found in core/Areas/AreaRegistry.php - About 2 hrs to fix

              PostEnvironment has 21 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class PostEnvironment implements JsonSerializable, EnvironmentInterface
              {
              
                  /**
                   * generic low-level data handler
              Severity: Minor
              Found in core/Backend/Environment/PostEnvironment.php - About 2 hrs to fix

                Function openFrame has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  openFrame: function (editmode) {
                    var that = this, metadata, frameoptions;
                    if (this.frame) {
                      this.frame.dispose();
                    }
                Severity: Major
                Found in js/src/fields/controls/cropimage.js - About 2 hrs to fix

                  Function openFrame has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    openFrame: function (editmode) {
                      var that = this, metadata;
                      if (this.frame) {
                        this.frame.dispose();
                      }
                  Severity: Major
                  Found in js/src/fields/controls/image.js - About 2 hrs to fix

                    Method markVisibility has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function markVisibility(Field $field)
                        {
                    
                            $field->setVisibility(true);
                            $areaContext = $this->entity->getContext()->get('areaContext');
                    Severity: Major
                    Found in core/Fields/ModuleFieldSection.php - About 2 hrs to fix

                      Method getAdditionalClasses has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getAdditionalClasses(Module $module)
                          {
                              $classes = array();
                      
                              $nextHash = null;
                      Severity: Major
                      Found in core/Frontend/Renderer/AreaRenderer.php - About 2 hrs to fix

                        Function areasForContext has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function areasForContext($postId = null, $context)
                        {
                            global $post;
                            $postId = (null === $postId) ? $post->ID : $postId;
                            $environment = Utilities::getPostEnvironment($postId);
                        Severity: Minor
                        Found in includes/kb-api.php - About 2 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 markVisibility has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function markVisibility(Field $field)
                            {
                        
                                $field->setVisibility(true);
                                $areaContext = $this->entity->getContext()->get('areaContext');
                        Severity: Minor
                        Found in core/Fields/ModuleFieldSection.php - About 2 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 prepareFormValue has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function prepareFormValue($val)
                            {
                                if (is_numeric($val)) {
                                    return filter_var($val, FILTER_SANITIZE_NUMBER_INT);
                                } else if (is_string($val)) {
                        Severity: Minor
                        Found in core/Fields/Definitions/Select.php - About 2 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 save has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function save($data, $old)
                            {
                                if (is_null($data)) {
                                    return $old;
                                }
                        Severity: Minor
                        Found in core/Fields/Definitions/GalleryExt.php - About 2 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 setupItems has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function setupItems()
                            {
                                if (!empty($this->items)) {
                                    return $this->items;
                                }
                        Severity: Minor
                        Found in core/Fields/Definitions/ReturnObjects/FlexibleFieldsReturn.php - About 2 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

                        Severity
                        Category
                        Status
                        Source
                        Language