seb86/Auto-Load-Next-Post

View on GitHub

Showing 88 of 140 total issues

Method add_debug_info has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function add_debug_info( $debug_info ) {
            $debug_info['auto-load-next-post'] = array(
                'label'    => esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ),
                'fields'   => array(
                    // Theme Selectors
Severity: Major
Found in includes/admin/class-alnp-admin-site-health.php - About 2 hrs to fix

    File scanner.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* global alnp_scanner_params */
    ( function( $, params ) {
    
        var step                 = '',
            search_finished      = true,
    Severity: Minor
    Found in assets/js/admin/scanner.js - About 2 hrs to fix

      Method get_settings has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function get_settings() {
                  return apply_filters(
                      'alnp_misc_settings', array(
      
                          'title' => array(
      Severity: Major
      Found in includes/admin/settings/class-alnp-settings-misc.php - About 2 hrs to fix

        Function search_elements has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function search_elements( action ) {
                $.ajax({
                    method: "GET",
                    url: request_url + '?action=' + action,
                    dataType: 'json',
        Severity: Major
        Found in assets/js/admin/scanner.js - About 2 hrs to fix

          Function auto_load_next_post_seconds_to_words has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              function auto_load_next_post_seconds_to_words( $seconds ) {
                  // Get the years.
                  $years = ( intval( $seconds ) / YEAR_IN_SECONDS ) % 100;
                  if ( $years > 1 ) {
                      /* translators: Number of years */
          Severity: Minor
          Found in includes/auto-load-next-post-formatting-functions.php - About 2 hrs 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 alnp_init_customizer has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

                  public function alnp_init_customizer( $wp_customize ) {
                      /**
                       * Dont add settings to the customizer if the user does
                       * not have permission to make changes to the theme.
                       */
          Severity: Minor
          Found in includes/customizer/class-alnp-customizer.php - About 2 hrs 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

          Method admin_scripts has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public function admin_scripts() {
                      $screen    = get_current_screen();
                      $screen_id = $screen ? $screen->id : '';
          
                      if ( $screen_id == 'settings_page_auto-load-next-post' ) {
          Severity: Major
          Found in includes/admin/class-alnp-admin-assets.php - About 2 hrs to fix

            Function success has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        success: function( data ) {
                            $(data).each( function( index, selector ) {
                                var element = $(post).find(selector);
            
                                // Check if element was found in post.
            Severity: Major
            Found in assets/js/admin/scanner.js - About 2 hrs to fix

              Function auto_load_next_post has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function auto_load_next_post() {
                      // If the user can not read any more then stop looking for new posts.
                      if ( stop_reading ) {
                          return;
                      }
              Severity: Major
              Found in assets/js/frontend/auto-load-next-post.js - About 2 hrs to fix

                Method alnp_init_customizer has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public function alnp_init_customizer( $wp_customize ) {
                            /**
                             * Dont add settings to the customizer if the user does
                             * not have permission to make changes to the theme.
                             */
                Severity: Major
                Found in includes/customizer/class-alnp-customizer.php - About 2 hrs to fix

                  Function get_settings has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                          public function get_settings() {
                              $settings = array();
                  
                              $description = sprintf( __( 'This helps fine tune %s to locate your theme templates directory in order to display content in the same style as your theme.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) );
                  
                  
                  Severity: Minor
                  Found in includes/admin/settings/class-alnp-settings-templates.php - About 2 hrs 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 update_alnp_theme_selectors has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function update_alnp_theme_selectors( $stylesheet = '', $old_theme = false ) {
                          // Check if Auto Load Next Post is supported before updating the theme selectors.
                          if ( is_alnp_supported() ) {
                              $theme_support = get_theme_support( 'auto-load-next-post' );
                  
                  
                  Severity: Minor
                  Found in includes/theme-support/class-alnp-theme-support.php - About 2 hrs 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

                  Method get_settings has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public function get_settings() {
                              $settings = array();
                  
                              $description = sprintf( __( 'This helps fine tune %s to locate your theme templates directory in order to display content in the same style as your theme.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) );
                  
                  
                  Severity: Minor
                  Found in includes/admin/settings/class-alnp-settings-templates.php - About 2 hrs to fix

                    Method output has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            public function output( $current_view ) {
                                if ( $current_view !== 'getting-started' ) {
                                    return;
                                }
                    
                    
                    Severity: Minor
                    Found in includes/admin/class-alnp-getting-started.php - About 1 hr to fix

                      Function checkPendingRequest has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function checkPendingRequest() {
                              if ( $.active > 0 ) {
                                  window.setTimeout(checkPendingRequest, 8000);
                              }
                              else {
                      Severity: Minor
                      Found in assets/js/admin/scanner.js - About 1 hr to fix

                        Function alnp_template_redirect has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function alnp_template_redirect() {
                                global $wp_query;
                        
                                // If this is not a request for alnp or a singular object then bail.
                                if ( ! isset( $wp_query->query_vars['alnp'] ) || ! is_singular() ) {
                        Severity: Minor
                        Found in includes/auto-load-next-post-template-functions.php - About 1 hr 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_settings has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                                public function get_settings() {
                                    global $blog_id;
                        
                                    $settings = array();
                        
                        
                        Severity: Minor
                        Found in includes/admin/settings/class-alnp-settings-theme-selectors.php - About 1 hr 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 load_file has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                                public static function load_file( $name, $file_path, $is_script = false, $support = array(), $version = '', $footer = false ) {
                                    $url = AUTO_LOAD_NEXT_POST_URL_PATH . $file_path; // URL to the file.
                        
                                    if ( file_exists( AUTO_LOAD_NEXT_POST_FILE_PATH . $file_path ) ) {
                                        if ( $is_script ) {
                        Severity: Minor
                        Found in auto-load-next-post.php - About 1 hr 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 set_theme_selectors has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                                private static function set_theme_selectors() {
                                    if ( is_alnp_supported() ) {
                                        $content_container    = alnp_get_theme_support( 'content_container' );
                                        $title_selector       = alnp_get_theme_support( 'title_selector' );
                                        $navigation_container = alnp_get_theme_support( 'navigation_container' );
                        Severity: Minor
                        Found in includes/class-alnp-install.php - About 1 hr 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 alnp_find_template has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function alnp_find_template( $location = '', $post_type, $post_format ) {
                                // Templates to look for based on the post that is loaded.
                                $templates = alnp_get_templates( $post_type, $post_format );
                        
                                $found = false;
                        Severity: Minor
                        Found in includes/auto-load-next-post-template-functions.php - About 1 hr 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