rilwis/meta-box

View on GitHub

Showing 117 of 254 total issues

Function initialize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        initialize: function ( options ) {
            var that = this,
                fieldName = options.input.name;
            this.$input = $( options.input );

Severity: Minor
Found in js/media.js - About 1 hr to fix

    Method check_updates has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function check_updates( $data ) {
            static $response = null;
    
            $request = rwmb_request();
    
    
    Severity: Minor
    Found in src/Updater/Checker.php - About 1 hr to fix

      Function click .button has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  'click .button': function () {
                      if ( this._frame ) {
                          this._frame.dispose();
                      }
                      var maxFiles = this.controller.get( 'maxFiles' );
      Severity: Minor
      Found in js/media.js - About 1 hr to fix

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

            public static function html( $meta, $field ) {
                $meta      = array_filter( (array) $meta );
                $i18n_more = apply_filters( 'rwmb_file_add_string', _x( '+ Add new file', 'file upload', 'meta-box' ), $field );
                $html      = self::get_uploaded_files( $meta, $field );
        
        
        Severity: Minor
        Found in inc/fields/file.php - About 1 hr to fix

          Method file_info has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function file_info( $file, $args = [], $field = [] ) {
                  $path = get_attached_file( $file );
                  if ( ! $path ) {
                      return false;
                  }
          Severity: Minor
          Found in inc/fields/image.php - About 1 hr to fix

            Method normalize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function normalize( $field ) {
                    $field = wp_parse_args( $field, [
                        'timestamp'    => false,
                        'inline'       => false,
                        'js_options'   => [],
            Severity: Minor
            Found in inc/fields/datetime.php - About 1 hr to fix

              Function initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      initialize: function ( options ) {
                          this.controller = options.controller;
                          this.collection = this.controller.get( 'items' );
                          this.itemView = options.itemView || MediaItem;
                          this.getItemView = _.memoize( function ( item ) {
              Severity: Minor
              Found in js/media.js - About 1 hr to fix

                Function addNew has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function addNew() {
                        const $this = $( this );
                
                        $this.rwmbModal( {
                            removeElement: '#editor .interface-interface-skeleton__footer, .edit-post-fullscreen-mode-close',
                Severity: Minor
                Found in js/post.js - About 1 hr to fix

                  Function transport has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              options.ajax.transport = function ( params, success, failure ) {
                                  if ( params.data._type === 'query' ) {
                                      delete params.data.page;
                                  }
                  
                  
                  Severity: Minor
                  Found in js/select-advanced.js - About 1 hr to fix

                    Method rules has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function rules( RW_Meta_Box $meta_box ) {
                            $settings = $meta_box->meta_box;
                            if ( empty( $settings['validation'] ) ) {
                                return;
                            }
                    Severity: Minor
                    Found in inc/validation.php - About 1 hr to fix

                      Function displayMap has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function displayMap() {
                              var osmTileLayer = L.tileLayer( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
                                  attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
                              } );
                              var options = $( this ).data( 'osm_options' ),
                      Severity: Minor
                      Found in js/osm-frontend.js - About 1 hr to fix

                        Method ajax_delete_file has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function ajax_delete_file() {
                                $request  = rwmb_request();
                                $field_id = (string) $request->filter_post( 'field_id' );
                                $type     = str_contains( $request->filter_post( 'field_name' ), '[' ) ? 'child' : 'top';
                                check_ajax_referer( "rwmb-delete-file_{$field_id}" );
                        Severity: Minor
                        Found in inc/fields/file.php - About 1 hr to fix

                          Function check_updates has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function check_updates( $data ) {
                                  static $response = null;
                          
                                  $request = rwmb_request();
                          
                          
                          Severity: Minor
                          Found in src/Updater/Checker.php - About 55 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 enqueue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function enqueue() {
                                  if ( is_admin() && ! $this->is_edit_screen() && ! $this->is_gutenberg_screen() ) {
                                      return;
                                  }
                          
                          
                          Severity: Minor
                          Found in inc/meta-box.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function save( $new, $old, $post_id, $field ) {
                                  if ( empty( $field['id'] ) || ! $field['save_field'] ) {
                                      return;
                                  }
                                  $name    = $field['id'];
                          Severity: Minor
                          Found in inc/field.php - About 55 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 meta has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function meta( $post_id, $saved, $field ) {
                                  /**
                                   * For special fields like 'divider', 'heading' which don't have ID, just return empty string
                                   * to prevent notice error when displaying fields.
                                   */
                          Severity: Minor
                          Found in inc/field.php - About 45 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 replace has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  replace: function ( index, value, before, after, alternative, isEnd ) {
                          Severity: Minor
                          Found in js/clone.js - About 45 mins to fix

                            Function get_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private function get_value( $field_id, $object_id, $atts ) {
                                    // If we pass object_id via shortcode, we need to make sure current user 
                                    // has permission to view the object
                                    if ( ! is_null ( $object_id ) ) {
                                        $has_object_permission = $this->check_object_permission( $object_id, $atts );
                            Severity: Minor
                            Found in inc/shortcode.php - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function save() {
                                    $request = rwmb_request();
                                    if ( ! $request->post( 'submit' ) ) {
                                        return;
                                    }
                            Severity: Minor
                            Found in src/Updater/Settings.php - About 45 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 normalize_icon has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private static function normalize_icon( array $field, $key, $icon ): array {
                                    // Default: Font Awesome Free.
                                    if ( $field['icon_set'] === 'font-awesome-free' ) {
                                        $style = $icon['styles'][0];
                                        return [
                            Severity: Minor
                            Found in inc/fields/icon.php - About 45 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