rilwis/meta-box

View on GitHub

Showing 254 of 254 total issues

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

                            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 $.validator.normalizeRule( validator.settings.rules[ key ] ) || {};
                                Severity: Major
                                Found in js/validation/validation.js - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                          return $new;
                                  Severity: Major
                                  Found in inc/fields/datetime.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                            return [
                                                'value' => $icon,
                                                'label' => $icon,
                                                'svg'   => '',
                                            ];
                                    Severity: Major
                                    Found in inc/fields/icon.php - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language