kai-jacobsen/kontentblocks

View on GitHub

Showing 398 of 4,293 total issues

Method editor has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    static public function editor($id, $data, $name = null, $media = false, $args = array())
Severity: Minor
Found in core/Utils/Utilities.php - About 35 mins to fix

    Method registerFieldData has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function registerFieldData($modid, $type, $data, $key, $arrayKey)
    Severity: Minor
    Found in core/Utils/JSONTransport.php - About 35 mins to fix

      Method getField has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function getField($type, $baseId, $subkey, $key, $args = array())
      Severity: Minor
      Found in core/Fields/FieldRegistry.php - About 35 mins to fix

        Function getFieldArgs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          getFieldArgs: function (id, key) {
            if (KB.payload.Fields && KB.payload.Fields[id]) {
              if (key && KB.payload.Fields[id][key]) {
                return KB.payload.Fields[id][key];
              } else {
        Severity: Minor
        Found in js/src/common/Payload.js - About 35 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

        Function getSlotModule has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          getSlotModule: function (slotId) {
            var value = this.model.get('value').modules || {};
        
            var module = value[slotId];
            if (module) {
        Severity: Minor
        Found in js/src/fields/controls/subarea/SubareaController.js - About 35 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

        Function prepareModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function prepareModel()
            {
                $savedData = $this->model->export();
                if ($this->fields) {
                    $data = array();
        Severity: Minor
        Found in core/Modules/Module.php - About 35 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

        Function findDefaultTemplate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function findDefaultTemplate()
            {
                $keys = array_values($this->views);
                if (method_exists($this->module, 'defaultView')) {
                    $setByModule = $this->module->defaultView();
        Severity: Minor
        Found in core/Modules/ModuleViewManager.php - About 35 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

        Function deleteModule has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function deleteModule(Module $module)
            {
                if ($module->properties->globalModule) {
                    $parentId = $module->properties->parentObjectId;
                    $meta = get_post_meta($parentId, '_kb_attached_to', true);
        Severity: Minor
        Found in core/Modules/Core/ModuleGlobalModuleProxy/ModuleGlobalModuleProxy.php - About 35 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

        Function MediaWorkflow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        KB.Utils.MediaWorkflow = function (args) {
          var _frame, options;
        
          var defaults = {
            buttontext: 'Buttontext',
        Severity: Minor
        Found in js/src/common/MediaWorkflow.js - About 35 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

        Function setupUtilities has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            private function setupUtilities()
            {
        
        
                $this->services['utility.logger'] = function ($container) {
        Severity: Minor
        Found in kontentblocks.php - About 35 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

        Function save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function save($postId, $postObj)
            {
        
                // mic check one two, one two
                if ($this->auth() === false) {
        Severity: Minor
        Found in core/Backend/Environment/Save/SavePost.php - About 35 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

        Function create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function create()
            {
                if (is_array( $this->getDefinitionArray() ) && !$this->isLocked()) {
                    $update = $this->environment->getStorage()->addToIndex( $this->createModuleId(), $this->moduleattrs );
                    if (!is_null( $this->newData )) {
        Severity: Minor
        Found in core/Modules/ModuleWorkshop.php - About 35 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

        Function addArea has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function addArea($args, $manual = true)
            {
                if (!empty($args['id'])) {
                    $args['id'] = sanitize_title($args['id']);
                }
        Severity: Minor
        Found in core/Areas/AreaRegistry.php - About 35 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

        Function action has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected static function action(Request $request)
            {
                $postId = $request->request->getInt('postId', null);
                $environment = Utilities::getPostEnvironment($postId);
                $storage = $environment->getStorage();
        Severity: Minor
        Found in core/Ajax/Actions/BatchRemoveModules.php - About 35 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

        Function prepareModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function prepareModel()
            {
                $savedData = $this->model->export();
                if ($this->fields) {
                    $data = array();
        Severity: Minor
        Found in core/Panels/PostPanel.php - About 35 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

        Function setupDiff has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function setupDiff()
            {
                $trans = get_transient('kb_dynamic_areas');
        
                if (!$trans) {
        Severity: Minor
        Found in core/Areas/AreaDynamicManager.php - About 35 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

        Function hasModules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function hasModules($area)
            {
                if (!empty($this->index)) {
                    foreach ($this->index as $module) {
                        if ($module->area->id === $area && $module['draft'] !== 'true' && $module['active'] !== false) {
        Severity: Minor
        Found in core/Backend/Storage/ModuleStorage.php - About 35 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

        Function save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function save($postId, \WP_Post $postObj)
            {
                // auth request
                if (!$this->auth($postId)) {
                    return false;
        Severity: Minor
        Found in core/Backend/Dynamic/GlobalModulesMenu.php - About 35 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

        Function addString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function addString($string)
            {
                if (!is_string($string)) {
                    return false;
                }
        Severity: Minor
        Found in core/Backend/Environment/Save/ConcatContent.php - About 35 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

        Function prepareModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function prepareModel()
            {
                $savedData = $this->model->export();
                $model = $this->model;
                if ($this->fields) {
        Severity: Minor
        Found in core/Panels/UserPanel.php - About 35 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

        Severity
        Category
        Status
        Source
        Language