kai-jacobsen/kontentblocks

View on GitHub

Showing 398 of 4,293 total issues

Method registerPostType has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function registerPostType()
    {

        $labels = array(
            'name' => _x('Global Module', 'post type general name', 'Kontentblocks'),
Severity: Minor
Found in core/Backend/Dynamic/GlobalModulesMenu.php - About 1 hr 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 auth has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private function auth()
        {
    
            // if a revision gets restored, a new revision is created but everything from the normal edit screen is missing
            if ($this->isRevisionScreen === true) {
    Severity: Minor
    Found in core/Backend/Environment/Save/SaveRevision.php - 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 maybeRemoveAreas has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private function maybeRemoveAreas()
        {
            if ($this->isDirty && isset($_GET['kb-clean-me-up']) && $_GET['kb-clean-me-up'] === 'yeah') {
                foreach ($this->removedAreas as $id) {
                    $posts = get_posts(
    Severity: Minor
    Found in core/Areas/AreaDynamicManager.php - 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 action has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        protected static function action(Request $request)
        {
            $postId = $request->request->getInt('postId', null);
            $data = $request->request->get('data');
    
    
    Severity: Minor
    Found in core/Ajax/Actions/UpdateContextAreaOrder.php - 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 auth has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private function auth()
        {
            $all = $this->postdata->request->all();
            // verify if this is an auto save routine.
            // If it is our form has not been submitted, so we dont want to do anything
    Severity: Minor
    Found in core/Backend/Environment/Save/SavePost.php - 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 getFormFilter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getFormFilter($fielddata)
        {
            $collect = array();
            if (!empty($fielddata)) {
                foreach ($fielddata as $k => $v) {
    Severity: Minor
    Found in core/Fields/Definitions/RadioSet.php - 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 setupModules has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private function setupModules()
        {
            $collection = array();
            $json = array();
            $data = $this->slotConfig;
    Severity: Minor
    Found in core/Fields/Helper/SubmoduleRepository.php - 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 prepareValue has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function prepareValue($value)
        {
            if (!is_array($value)) {
                return $value;
            }
    Severity: Minor
    Found in core/Fields/Definitions/ReturnObjects/ImageReturn.php - 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 extractFieldsFromConfig has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private function extractFieldsFromConfig()
        {
            if (!is_array($this->types)) {
                return array();
            }
    Severity: Minor
    Found in core/Fields/Definitions/ReturnObjects/FlexibleFieldsReturn.php - 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 getFormFilter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getFormFilter( $fielddata )
        {
            $collect = array();
            if (!empty( $fielddata )) {
                foreach ($fielddata as $k => $v) {
    Severity: Minor
    Found in core/Fields/Definitions/CheckboxSet.php - 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 save has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

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

        public function save($new, $old)
        {
            $new = array_values($new);
    
            if (is_array($new) && is_array($old)) {
    Severity: Minor
    Found in core/Fields/Definitions/FileMultiple.php - 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

    Method setupModule has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function setupModule($module)
        {
    
            /** @var \Kontentblocks\Modules\ModuleRegistry $moduleRegistry */
            $moduleRegistry = Kontentblocks::getService('registry.modules');

      Function render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render: function () {
          var $source, $target, $sourcecontainer, $targetcontainer;
          var that = this;
          this.$('.kbml-slot').draggable({
            revert: 'invalid',
      Severity: Minor
      Found in js/src/fields/controls/subarea/AreaViewController.js - About 1 hr to fix

        Function draggable has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          draggable: function () {
            var $source, $target, $sourcecontainer, $targetcontainer;
            var that = this;
            this.$('.kbml-slot').draggable({
              revert: 'invalid',
        Severity: Minor
        Found in js/src/fields/controls/subarea/SubareaController.js - About 1 hr to fix

          Function reverse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              reverse: function(location, scale, cb, context) {
                var params = {
                  key: this._accessToken,
                  q: [location.lat, location.lng].join(',')
                };
          Severity: Minor
          Found in js/third-party/leaflet.js - About 1 hr to fix

            Function geocode has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                geocode: function(query, cb, context) {
                  var params = {
                    key: this._accessToken,
                    q: query
                  };
            Severity: Minor
            Found in js/third-party/leaflet.js - About 1 hr to fix

              Method duplicate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function duplicate()
                  {
                      global $post;
                      $post = get_post(self::$postId);
                      setup_postdata($post);
              Severity: Minor
              Found in core/Ajax/Actions/DuplicateModule.php - About 1 hr to fix

                Method globalModule has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function globalModule($gmodule)
                    {
                        global $post;
                        if (empty($gmodule)) {
                            wp_die('no template arg provided');
                Severity: Minor
                Found in core/Backend/Dynamic/GlobalModulesMenu.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language