seb86/Auto-Load-Next-Post

View on GitHub

Showing 140 of 140 total issues

Avoid too many return statements within this method.
Open

            return __( 'a minute', 'auto-load-next-post' );
Severity: Major
Found in includes/auto-load-next-post-formatting-functions.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return sprintf( __( '%s seconds', 'auto-load-next-post' ), $seconds );
    Severity: Major
    Found in includes/auto-load-next-post-formatting-functions.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return sprintf( __( '%s minutes', 'auto-load-next-post' ), $minutes );
      Severity: Major
      Found in includes/auto-load-next-post-formatting-functions.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return sprintf( __( '%s days', 'auto-load-next-post' ), $days );
        Severity: Major
        Found in includes/auto-load-next-post-formatting-functions.php - About 30 mins to fix

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  $( 'body' ).on( 'mousewheel', function( e ) {
                      scroll_up = e.originalEvent.wheelDelta > 0;
                  });
          Severity: Minor
          Found in assets/js/frontend/auto-load-next-post.js and 1 other location - About 30 mins to fix
          assets/js/frontend/auto-load-next-post.dev.js on lines 197..199

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Avoid too many return statements within this method.
          Open

                      return __( 'an hour', 'auto-load-next-post' );
          Severity: Major
          Found in includes/auto-load-next-post-formatting-functions.php - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return false;
            Severity: Major
            Found in assets/js/frontend/auto-load-next-post.js - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return sprintf( __( '%s hours', 'auto-load-next-post' ), $hours );
              Severity: Major
              Found in includes/auto-load-next-post-formatting-functions.php - About 30 mins to fix

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        $( 'body' ).on( 'mousewheel', function( e ) {
                            scroll_up = e.originalEvent.wheelDelta > 0;
                        });
                Severity: Minor
                Found in assets/js/frontend/auto-load-next-post.dev.js and 1 other location - About 30 mins to fix
                assets/js/frontend/auto-load-next-post.js on lines 157..159

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 45.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Avoid too many return statements within this function.
                Open

                        return false;
                Severity: Major
                Found in assets/js/frontend/auto-load-next-post.dev.js - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return __( 'a second', 'auto-load-next-post' );
                  Severity: Major
                  Found in includes/auto-load-next-post-formatting-functions.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return __( 'a day', 'auto-load-next-post' );
                    Severity: Major
                    Found in includes/auto-load-next-post-formatting-functions.php - About 30 mins to fix

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

                              public function is_page_alnp_ready() {
                                  if ( is_front_page() && is_home() ) {
                                      return false;
                                  } elseif ( is_front_page() ) {
                                      return false;
                      Severity: Minor
                      Found in includes/customizer/class-alnp-customizer.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 install has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public static function install() {
                                  if ( ! is_blog_installed() ) {
                                      return;
                                  }
                      
                      
                      Severity: Minor
                      Found in includes/class-alnp-install.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 find_template_location has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public static function find_template_location() {
                                  $post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : 'post';
                      
                                  if ( empty( $post_type ) ) {
                                      wp_send_json( -1 );
                      Severity: Minor
                      Found in includes/class-alnp-ajax.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 lock_js_in_footer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public static function lock_js_in_footer( $settings ) {
                                  $js_locked_in_footer = get_option( 'auto_load_next_post_lock_js_in_footer' );
                      
                                  if ( ! empty( $js_locked_in_footer ) && $js_locked_in_footer == 'yes' ) {
                                      // Setting key to look for.
                      Severity: Minor
                      Found in includes/admin/settings/class-alnp-settings-misc.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 alnp_include_theme_support has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function alnp_include_theme_support() {
                          $themes_supported = alnp_themes_supported();
                      
                          if ( is_alnp_active_theme( $themes_supported ) ) {
                              foreach( $themes_supported as $theme ) {
                      Severity: Minor
                      Found in includes/auto-load-next-post-themes-supported.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 includes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public function includes() {
                                  global $wp_version;
                      
                                  include( dirname( __FILE__ ) . '/class-alnp-admin-action-links.php' );        // Action Links
                                  include( dirname( __FILE__ ) . '/class-alnp-admin-assets.php' );              // Admin Assets
                      Severity: Minor
                      Found in includes/admin/class-alnp-admin.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 settings_page_init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public function settings_page_init() {
                                  global $current_view, $current_section;
                      
                                  // Include settings pages.
                                  include_once( dirname( __FILE__ ) . '/class-alnp-admin-settings.php' );
                      Severity: Minor
                      Found in includes/admin/class-alnp-admin.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 alnp_get_random_page_permalink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          function alnp_get_random_page_permalink( $post_type = 'post' ) {
                              $args = array(
                                  'post_type'      => $post_type,
                                  'post_status'    => 'publish',
                                  'orderby'        => 'rand',
                      Severity: Minor
                      Found in includes/auto-load-next-post-core-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

                      Severity
                      Category
                      Status
                      Source
                      Language