kai-jacobsen/kontentblocks

View on GitHub

Showing 4,293 of 4,293 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      data: {
        action: 'updatePostPanel',
        data: that.toJSON().entityData,
        panel: that.toJSON(),
        editmode: (save) ? 'update' : 'preview',
Severity: Major
Found in js/src/frontend/Models/PanelModel.js and 1 other location - About 1 hr to fix
js/src/frontend/Models/ModuleModel.js on lines 60..66

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 63.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      reverse: function(location, scale, cb, context) {
        getJSON(
          this.options.serviceUrl +
          encodeURIComponent(location.lng) +
          ',' +
Severity: Minor
Found in js/third-party/leaflet-geocoder.js - About 1 hr to fix

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

        reverse: function(location, scale, cb, context) {
          getJSON(
            this.options.serviceUrl +
            encodeURIComponent(location.lng) +
            ',' +
    Severity: Minor
    Found in js/third-party/leaflet.js - About 1 hr to fix

      Method upscale has 34 lines of code (exceeds 25 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 1 hr to fix

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            } else {
              KB.Views.Areas.add(area.get('id'), new SystemAreaView({
                model: area,
                el: '#' + area.get('id') + '-kb-container'
              }));
        Severity: Major
        Found in js/src/backend/BackendController.js and 2 other locations - About 1 hr to fix
        js/src/backend/BackendController.js on lines 185..190
        js/src/backend/BackendController.js on lines 198..203

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

              initialize: function(accessToken, options) {
                L.setOptions(this, options);
                this.options.geocodingQueryParams.access_token = accessToken;
                this.options.reverseQueryParams.access_token = accessToken;
              },
        Severity: Major
        Found in js/third-party/leaflet-geocoder.js and 1 other location - About 1 hr to fix
        js/third-party/leaflet.js on lines 539..543

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

          function createPanelViews(panel) {
            KB.Views.Areas.add(panel.get('id'), new PanelView({
              model: panel,
              el: '#kbp-' + panel.get('baseId') + '-kb-container'
            }));
        Severity: Major
        Found in js/src/backend/BackendController.js and 2 other locations - About 1 hr to fix
        js/src/backend/BackendController.js on lines 185..190
        js/src/backend/BackendController.js on lines 190..195

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

          render: function () {
            this.$el.append(tpl({model: this.model.toJSON(), i18n: KB.i18n}));
            return this.$el;
          },
        js/src/shared/ModuleStatusBar/status/Settings/controls/LoggedInOnly.js on lines 4..7

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

          render: function () {
            this.$el.append(tpl({model: this.model.toJSON(), i18n: KB.i18n}));
            return this.$el;
          },
        js/src/shared/ModuleStatusBar/status/Settings/controls/WrapperClasses.js on lines 4..7

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            initialize: function(accessToken, options) {
              L.setOptions(this, options);
              this.options.geocodingQueryParams.access_token = accessToken;
              this.options.reverseQueryParams.access_token = accessToken;
            },
        Severity: Major
        Found in js/third-party/leaflet.js and 1 other location - About 1 hr to fix
        js/third-party/leaflet-geocoder.js on lines 698..702

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            if (area.get('public')) {
              KB.Views.Areas.add(area.get('id'), new AreaView({
                model: area,
                el: '#' + area.get('id') + '-kb-container'
              }));
        Severity: Major
        Found in js/src/backend/BackendController.js and 2 other locations - About 1 hr to fix
        js/src/backend/BackendController.js on lines 190..195
        js/src/backend/BackendController.js on lines 198..203

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Avoid using short method names like EditableElement::el(). The configured minimum method name length is 3.
        Open

            public function el( $el )
            {
                $this->el = $el;
                return $this;
        
        

        ShortMethodName

        Since: 0.2

        Detects when very short method names are used.

        Example

        class ShortMethod {
            public function a( $index ) { // Violation
            }
        }

        Source https://phpmd.org/rules/naming.html#shortmethodname

        Avoid using short method names like LayoutAreaRenderer::el(). The configured minimum method name length is 3.
        Open

            public function el($attr)
            {
                $attr = esc_attr($attr);
                return "data-kba-el='{$attr}'";
            }

        ShortMethodName

        Since: 0.2

        Detects when very short method names are used.

        Example

        class ShortMethod {
            public function a( $index ) { // Violation
            }
        }

        Source https://phpmd.org/rules/naming.html#shortmethodname

        Avoid using short method names like EditableImage::mq(). The configured minimum method name length is 3.
        Open

            public function mq($string)
            {
                $this->image->mq($string);
                return $this;
            }

        ShortMethodName

        Since: 0.2

        Detects when very short method names are used.

        Example

        class ShortMethod {
            public function a( $index ) { // Violation
            }
        }

        Source https://phpmd.org/rules/naming.html#shortmethodname

        Avoid using short method names like ImageReturn::mq(). The configured minimum method name length is 3.
        Open

            public function mq($string)
            {
                $this->mediaQueries[] = $string;
                return $this;
            }

        ShortMethodName

        Since: 0.2

        Detects when very short method names are used.

        Example

        class ShortMethod {
            public function a( $index ) { // Violation
            }
        }

        Source https://phpmd.org/rules/naming.html#shortmethodname

        Function calculateImageSelectOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            calculateImageSelectOptions: function (attachment, controller) {
              var xInit = parseInt(controller.frame.options.cropOptions.maxWidth, 10),
                yInit = parseInt(controller.frame.options.cropOptions.maxHeight, 10),
                ratio, xImg, yImg, realHeight, realWidth,
                imgSelectOptions;
        Severity: Minor
        Found in js/src/wpMediaExt/KB.media.Crop.js - About 1 hr to fix

          Function setupSortables has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            setupSortables: function () {
              var that = this;
              this.$el.sortable(
                {
                  handle: ".kb-module-control--move",
          Severity: Minor
          Found in js/src/frontend/Views/AreaView.js - About 1 hr to fix

            Method saveModules has 33 lines of code (exceeds 25 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 1 hr to fix

              Method auth has 33 lines of code (exceeds 25 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

                Method action has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected static function action(Request $request)
                    {
                        global $post;
                
                        $moduleArgs = Utilities::validateBoolRecursive($request->get('module'));
                Severity: Minor
                Found in core/Ajax/Actions/UpdateModuleData.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language