pfefferle/wordpress-semantic-linkbacks

View on GitHub

Showing 35 of 42 total issues

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

    public static function anonymous_avatar_data( $args, $id_or_email ) {
        $local = apply_filters( 'semantic_linkbacks_local_avatars', array( 'mm', 'mystery', 'mysteryman' ) );
        if ( ! in_array( $args['default'], $local, true ) ) {
            return $args;
        }
Severity: Minor
Found in includes/class-linkbacks-avatar-handler.php - About 1 hr to fix

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

        public static function comment_class( $classes, $class, $comment_id, $post_id ) {
            // get comment
            $comment = get_comment( $comment_id );
            // "comment type to class" mapper
            $class_mapping = array(
    Severity: Minor
    Found in includes/class-linkbacks-handler.php - About 1 hr to fix

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

      function get_linkbacks_number( $type = null, $post_id = null ) {
          if ( null === $post_id ) {
              $post_id = get_the_ID();
          }
          $args = array(
      Severity: Minor
      Found in includes/functions.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 enhance has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function enhance( $commentdata, $comment = array(), $commentarr = array() ) {
              // check if comment is a linkback
              if ( ! in_array( $commentdata['comment_type'], apply_filters( 'semantic_linkbacks_enhance_comment_types', array( 'webmention', 'pingback', 'trackback' ) ), true ) ) {
                  return $commentdata;
              }
      Severity: Minor
      Found in includes/class-linkbacks-handler.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 get_entries has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function get_entries( $mf_array ) {
              $entries = array();
      
              // some basic checks
              if ( ! is_array( $mf_array ) ) {
      Severity: Minor
      Found in includes/class-linkbacks-mf2-handler.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

      Avoid deeply nested control flow statements.
      Open

                                      if ( isset( $mf_array['rels']['me'] ) ) {
                                          $mf['properties']['me'] = $mf_array['rels']['me'];
                                      }
      Severity: Major
      Found in includes/class-linkbacks-mf2-handler.php - About 45 mins to fix

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

            public function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
        Severity: Minor
        Found in includes/class-linkbacks-walker-comment.php - About 35 mins to fix

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

              public static function bulk_send_notifications( $redirect_to, $doaction, $comment_ids ) {
                  if ( ! in_array( $doaction, array( 'resend_notification_email', 'resend_moderation_email', 'send_pushover_text' ), true ) ) {
                      return $redirect_to;
                  }
                  foreach ( $comment_ids as $comment_id ) {
          Severity: Minor
          Found in includes/class-linkbacks-notifications.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_linkbacks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          function get_linkbacks( $type = null, $post_id = null, $order = 'DESC' ) {
              if ( null === $post_id ) {
                  $post_id = get_the_ID();
              }
              $args = array(
          Severity: Minor
          Found in includes/functions.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 comment_text_excerpt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function comment_text_excerpt( $text, $comment = null, $args = array() ) {
                  if ( ! is_object( $comment ) ) {
                      $comment = get_comment( $comment );
                  }
          
          
          Severity: Minor
          Found in includes/class-linkbacks-handler.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 method.
          Open

                  return $args;
          Severity: Major
          Found in includes/class-linkbacks-avatar-handler.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return 'mention';
            Severity: Major
            Found in includes/class-linkbacks-mf2-handler.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $entries[0];
              Severity: Major
              Found in includes/class-linkbacks-mf2-handler.php - About 30 mins to fix

                Function save_comment_meta has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function save_comment_meta( $comment_id ) {
                        // If this is an autosave, our form has not been submitted, so we don't want to do anything.
                        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
                            return;
                        }
                Severity: Minor
                Found in includes/class-linkbacks-handler.php - About 25 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_property has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function get_property( $key, $properties ) {
                        if ( isset( $properties[ $key ] ) && isset( $properties[ $key ][0] ) ) {
                            if ( is_array( $properties[ $key ] ) ) {
                                $properties[ $key ] = array_unique( $properties[ $key ] );
                            }
                Severity: Minor
                Found in includes/class-linkbacks-mf2-handler.php - About 25 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