rilwis/meta-box

View on GitHub

Showing 117 of 254 total issues

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

    public static function raw_meta( $object_id, $field, $args = [] ) {
        if ( empty( $field['id'] ) ) {
            return '';
        }

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

Consider simplifying this complex logical expression.
Open

        if ( ! $is_plugin || $network_wide || $is_cli || $is_bulk_activate || $this->is_bundled() || $is_doing_ajax ) {
            return;
        }
Severity: Major
Found in inc/about/about.php - About 40 mins to fix

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

        public static function clone_value( $new, $old, $object_id, $field, $data_source = null ) {
    Severity: Minor
    Found in inc/fields/file.php - About 35 mins to fix

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

          public function start_el( &$output, $object, $depth = 0, $args = [], $current_object_id = 0 ) {
      Severity: Minor
      Found in inc/walkers/select.php - About 35 mins to fix

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

            public function start_el( &$output, $object, $depth = 0, $args = [], $current_object_id = 0 ) {
        Severity: Minor
        Found in inc/walkers/input-list.php - About 35 mins to fix

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

              public function modify_field( $field ) {
                  global $wpml_post_translations;
          
                  if ( empty( $field['id'] ) ) {
                      return $field;
          Severity: Minor
          Found in inc/wpml.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 get_by has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function get_by( array $args ) : array {
                  $meta_boxes = $this->data;
                  foreach ( $meta_boxes as $index => $meta_box ) {
                      foreach ( $args as $key => $value ) {
                          $meta_box_key = 'object_type' === $key ? $meta_box->get_object_type() : $meta_box->$key;
          Severity: Minor
          Found in inc/meta-box-registry.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

          Avoid too many return statements within this function.
          Open

              return false;
          Severity: Major
          Found in js/validation/additional-methods.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return val;
            Severity: Major
            Found in js/validation/jquery.validate.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return val.replace( /\r/g, "" );
              Severity: Major
              Found in js/validation/jquery.validate.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return value.length === 16;
                Severity: Major
                Found in js/validation/additional-methods.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return true;
                  Severity: Major
                  Found in js/validation/additional-methods.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return false;
                    Severity: Major
                    Found in js/validation/additional-methods.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return value.length === 15;
                      Severity: Major
                      Found in js/validation/additional-methods.js - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return current_user_can( $read_post, $object_id );
                        Severity: Major
                        Found in inc/shortcode.php - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return value.length === 15;
                          Severity: Major
                          Found in js/validation/additional-methods.js - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return $value[ $attribute ];
                            Severity: Major
                            Found in inc/shortcode.php - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return data;
                              Severity: Major
                              Found in js/validation/jquery.validate.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                    return val.substr( idx + 1 );
                                Severity: Major
                                Found in js/validation/jquery.validate.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return value.length === 14;
                                  Severity: Major
                                  Found in js/validation/additional-methods.js - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language