rilwis/meta-box

View on GitHub

Showing 254 of 254 total issues

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

        getAddress: function () {
            var that = this;

            return this.addressField.split( ',' )
                .map( function ( part ) {
Severity: Major
Found in js/map.js and 1 other location - About 3 hrs to fix
js/osm.js on lines 230..239

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 109.

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

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

<?php
use MetaBox\Support\Arr;

/**
 * The field base class.
Severity: Minor
Found in inc/field.php - About 3 hrs to fix

    Method html has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function html( $meta, $field ) {
            $meta = wp_parse_args( $meta, [
                'color'      => '',
                'image'      => '',
                'repeat'     => '',
    Severity: Major
    Found in inc/fields/background.php - About 3 hrs to fix

      File file.php has 305 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      defined( 'ABSPATH' ) || die;
      
      /**
       * The file upload file which allows users to upload files via the default HTML <input type="file">.
      Severity: Minor
      Found in inc/fields/file.php - About 3 hrs to fix

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

                initDomElements: function () {
                    this.$canvas = this.$container.find( '.rwmb-map-canvas' );
                    this.canvas = this.$canvas[ 0 ];
                    this.$coordinate = this.$container.find( '.rwmb-map' );
                    this.addressField = this.$container.data( 'address-field' );
        Severity: Major
        Found in js/map.js and 1 other location - About 3 hrs to fix
        js/osm.js on lines 28..33

        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 100.

        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 2 locations. Consider refactoring.
        Open

                initDomElements: function () {
                    this.$canvas = this.$container.find( '.rwmb-osm-canvas' );
                    this.canvas = this.$canvas[ 0 ];
                    this.$coordinate = this.$container.find( '.rwmb-osm' );
                    this.addressField = this.$container.data( 'address-field' );
        Severity: Major
        Found in js/osm.js and 1 other location - About 3 hrs to fix
        js/map.js on lines 26..31

        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 100.

        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 2 locations. Consider refactoring.
        Open

            function initImageField() {
                var $this = $( this ),
                    view = $this.data( 'view' );
        
                if ( view ) {
        Severity: Major
        Found in js/image-advanced.js and 1 other location - About 3 hrs to fix
        js/media.js on lines 567..580

        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 98.

        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 2 locations. Consider refactoring.
        Open

            function initMediaField() {
                var $this = $( this ),
                    view = $this.data( 'view' );
        
                if ( view ) {
        Severity: Major
        Found in js/media.js and 1 other location - About 3 hrs to fix
        js/image-advanced.js on lines 25..38

        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 98.

        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 rwmbModal has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            $.fn.rwmbModal = function ( options = {} ) {
                options = {
                    ...defaultOptions,
                    ...options
                };
        Severity: Major
        Found in js/modal.js - About 3 hrs to fix

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

              function getTimestamp( date ) {
                  if ( date === null ) {
                      return '';
                  }
                  var milliseconds = Date.UTC( date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds() );
          Severity: Major
          Found in js/date.js and 1 other location - About 3 hrs to fix
          js/datetime.js on lines 64..70

          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 95.

          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

              function getTimestamp( date ) {
                  if ( date === null ) {
                      return '';
                  }
                  var milliseconds = Date.UTC( date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds() );
          Severity: Major
          Found in js/datetime.js and 1 other location - About 3 hrs to fix
          js/date.js on lines 64..70

          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 95.

          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 2 locations. Consider refactoring.
          Open

                          this._frame.on( 'open', function() {
                              var frameContent = this._frame.content.get();
                              if ( frameContent && frameContent.collection ) {
                                  frameContent.collection.mirroring._hasMore = true;
                                  frameContent.collection.more();
          Severity: Major
          Found in js/media.js and 1 other location - About 2 hrs to fix
          js/media.js on lines 273..279

          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 94.

          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 2 locations. Consider refactoring.
          Open

                      this._switchFrame.on( 'open', function() {
                          var frameContent = this._switchFrame.content.get();
                          if ( frameContent && frameContent.collection ) {
                              frameContent.collection.mirroring._hasMore = true;
                              frameContent.collection.more();
          Severity: Major
          Found in js/media.js and 1 other location - About 2 hrs to fix
          js/media.js on lines 370..376

          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 94.

          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 transform has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function transform() {
                  var $this = $( this ),
                      options = $this.data( 'options' );
          
                  $this.removeClass( 'select2-hidden-accessible' ).removeAttr( 'data-select2-id' );
          Severity: Major
          Found in js/select-advanced.js - About 2 hrs to fix

            RW_Meta_Box has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class RW_Meta_Box {
                /**
                 * Meta box parameters.
                 *
                 * @var array
            Severity: Minor
            Found in inc/meta-box.php - About 2 hrs to fix

              Function validate has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  validate: function( options ) {
              
                      // If nothing is selected, return nothing; can't chain anyway
                      if ( !this.length ) {
                          if ( options && options.debug && window.console ) {
              Severity: Major
              Found in js/validation/jquery.validate.js - About 2 hrs to fix

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

                        unhighlight: function( element, errorClass, validClass ) {
                            if ( element.type === "radio" ) {
                                this.findByName( element.name ).removeClass( errorClass ).addClass( validClass );
                            } else {
                                $( element ).removeClass( errorClass ).addClass( validClass );
                Severity: Major
                Found in js/validation/jquery.validate.js and 1 other location - About 2 hrs to fix
                js/validation/jquery.validate.js on lines 350..356

                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 86.

                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 2 locations. Consider refactoring.
                Open

                        highlight: function( element, errorClass, validClass ) {
                            if ( element.type === "radio" ) {
                                this.findByName( element.name ).addClass( errorClass ).removeClass( validClass );
                            } else {
                                $( element ).addClass( errorClass ).removeClass( validClass );
                Severity: Major
                Found in js/validation/jquery.validate.js and 1 other location - About 2 hrs to fix
                js/validation/jquery.validate.js on lines 357..363

                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 86.

                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

                RWMB_Field has 23 functions (exceeds 20 allowed). Consider refactoring.
                Open

                abstract class RWMB_Field {
                    public static function add_actions() {}
                
                    public static function admin_enqueue_scripts() {}
                
                
                Severity: Minor
                Found in inc/field.php - About 2 hrs to fix

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

                      public static function format_value( $field, $value, $args, $post_id ) {
                          $output = '<table><thead><tr>';
                          foreach ( $field['options'] as $label ) {
                              $output .= "<th>$label</th>";
                          }
                  Severity: Major
                  Found in inc/fields/text-list.php and 1 other location - About 2 hrs to fix
                  inc/fields/fieldset-text.php on lines 69..85

                  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 131.

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language