pubsubhubbub/wordpress-pubsubhubbub

View on GitHub

Showing 6 of 6 total issues

Method add_help_tab has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function add_help_tab() {
        get_current_screen()->add_help_tab(
            array(
                'id'      => 'overview',
                'title'   => __( 'Overview', 'pubsubhubbub' ),
Severity: Major
Found in includes/class-pubsubhubbub-admin.php - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if (
            ( is_feed( $supported_feed_types ) && ! is_date() && ! is_post_type_archive() && ! is_singular() ) ||
            ( is_feed( $supported_comment_feed_types ) && is_singular() ) ||
            ( is_home() && current_theme_supports( 'microformats2' ) )
        ) {
    Severity: Critical
    Found in includes/functions.php - About 1 hr to fix

      Method publish_update has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function publish_update( $topic_urls, $hub_url ) {
              if ( ! isset( $hub_url ) ) {
                  return new WP_Error( 'missing_hub_url', __( 'Please specify a hub url', 'pubsubhubbub' ) );
              }
      
      
      Severity: Minor
      Found in includes/class-pubsubhubbub-publisher.php - About 1 hr to fix

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

            public static function publish_update( $topic_urls, $hub_url ) {
                if ( ! isset( $hub_url ) ) {
                    return new WP_Error( 'missing_hub_url', __( 'Please specify a hub url', 'pubsubhubbub' ) );
                }
        
        
        Severity: Minor
        Found in includes/class-pubsubhubbub-publisher.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 pubsubhubbub_show_discovery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function pubsubhubbub_show_discovery() {
            $show_discovery = false;
        
            $supported_feed_types = apply_filters( 'pubsubhubbub_show_discovery_for_feed_types', pubsubhubbub_get_supported_feed_types() );
            $supported_comment_feed_types = apply_filters( 'pubsubhubbub_show_discovery_for_comment_feed_types', pubsubhubbub_get_supported_comment_feed_types() );
        Severity: Minor
        Found in includes/functions.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_feed_urls_by_post_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function get_feed_urls_by_post_id( $post_id ) {
                $post = get_post( $post_id );
        
                $feed_types = pubsubhubbub_get_supported_feed_types();
        
        
        Severity: Minor
        Found in includes/class-pubsubhubbub-publisher.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