seb86/Auto-Load-Next-Post

View on GitHub

Showing 140 of 140 total issues

Function output_fields has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring.
Open

        public static function output_fields( $options ) {
            foreach ( $options as $key => $value ) {

            if ( ! isset( $value['type'] ) ) {
                    continue;
Severity: Minor
Found in includes/admin/class-alnp-admin-settings.php - About 2 days 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 exports has 315 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(grunt) {
    'use strict';

    var sass = require( 'node-sass' );

Severity: Major
Found in Gruntfile.js - About 1 day to fix

    Method output_fields has 269 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public static function output_fields( $options ) {
                foreach ( $options as $key => $value ) {
    
                if ( ! isset( $value['type'] ) ) {
                        continue;
    Severity: Major
    Found in includes/admin/class-alnp-admin-settings.php - About 1 day to fix

      Function save_fields has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
      Open

              public static function save_fields( $options ) {
                  if ( empty( $_POST ) ) {
                      return false;
                  }
      
      
      Severity: Minor
      Found in includes/admin/class-alnp-admin-settings.php - About 1 day 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

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

          $('#tab-panel-auto_load_next_post_wizard_tab a.button').click( function(e) {
              var clicked_url = $(this).attr('href');
      
              e.preventDefault();
      
      
      Severity: Major
      Found in assets/js/admin/settings.js and 1 other location - About 1 day to fix
      assets/js/admin/settings.js on lines 134..165

      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 195.

      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

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

          $('a.reset-settings').click( function(e) {
              var clicked_url = $(this).attr('href');
      
              e.preventDefault();
      
      
      Severity: Major
      Found in assets/js/admin/settings.js and 1 other location - About 1 day to fix
      assets/js/admin/settings.js on lines 168..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 195.

      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

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

      var version             = auto_load_next_post_params.alnp_version,
          content_container   = auto_load_next_post_params.alnp_content_container,
          post_title_selector = auto_load_next_post_params.alnp_title_selector,
          nav_container       = auto_load_next_post_params.alnp_navigation_container,
          comments_container  = auto_load_next_post_params.alnp_comments_container,
      Severity: Major
      Found in assets/js/frontend/auto-load-next-post.js and 1 other location - About 7 hrs to fix
      assets/js/frontend/auto-load-next-post.dev.js on lines 2..23

      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 190.

      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

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

      var version             = auto_load_next_post_params.alnp_version,
          content_container   = auto_load_next_post_params.alnp_content_container,
          post_title_selector = auto_load_next_post_params.alnp_title_selector,
          nav_container       = auto_load_next_post_params.alnp_navigation_container,
          comments_container  = auto_load_next_post_params.alnp_comments_container,
      Severity: Major
      Found in assets/js/frontend/auto-load-next-post.dev.js and 1 other location - About 7 hrs to fix
      assets/js/frontend/auto-load-next-post.js on lines 2..23

      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 190.

      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

      File class-alnp-admin-settings.php has 433 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Auto Load Next Post - Admin Settings Class.
       *
       * @since    1.0.0
      Severity: Minor
      Found in includes/admin/class-alnp-admin-settings.php - About 6 hrs to fix

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

                                if ( action == 'alnp_get_container_selectors' && content_container == '' ) {
                                    $('.selectors').find('.container').removeClass('pending').addClass('found');
                                    $('.results-found').find('.container').addClass('found');
                                    $('.results-found').find('.container span.result').html('<code title="' + params.i18n_copy_title + '">' + selector + '</code>');
                                    content_container = selector;
        Severity: Major
        Found in assets/js/admin/scanner.js and 1 other location - About 4 hrs to fix
        assets/js/admin/scanner.js on lines 220..226

        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 134.

        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

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

                                if ( action == 'alnp_get_title_selectors' && post_title == '' ) {
                                    $('.selectors').find('.title').removeClass('pending').addClass('found');
                                    $('.results-found').find('.title').addClass('found');
                                    $('.results-found').find('.title span.result').html('<code title="' + params.i18n_copy_title + '">' + selector + '</code>');
                                    post_title = selector;
        Severity: Major
        Found in assets/js/admin/scanner.js and 1 other location - About 4 hrs to fix
        assets/js/admin/scanner.js on lines 212..218

        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 134.

        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

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

            function triggerEvents(events, params) {
                if (typeof events !== 'string') return;
        
                var body = jQuery( 'body' );
        
        
        Severity: Major
        Found in assets/js/frontend/auto-load-next-post.dev.js and 1 other location - About 4 hrs to fix
        assets/js/frontend/auto-load-next-post.js on lines 219..233

        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 133.

        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

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

            function triggerEvents(events, params) {
                if (typeof events !== 'string') return;
        
                var body = jQuery( 'body' );
        
        
        Severity: Major
        Found in assets/js/frontend/auto-load-next-post.js and 1 other location - About 4 hrs to fix
        assets/js/frontend/auto-load-next-post.dev.js on lines 264..278

        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 133.

        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

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

                public function get_settings() {
                    global $blog_id;
        
                    $settings = array();
        
        
        Severity: Major
        Found in includes/admin/settings/class-alnp-settings-theme-selectors.php - About 4 hrs to fix

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

                  public function output( $current_view ) {
                      if ( $current_view !== 'setup-wizard' ) {
                          return;
                      }
          
          
          Severity: Major
          Found in includes/admin/class-alnp-setup-wizard.php - About 4 hrs to fix

            Function run_alnp has 101 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function run_alnp() {
                    if ( $( 'article' ).length <= 0 ) {
                        console.log( 'HTML5 semantics for article has not been found. Setting compatible HTML semantic.' );
                        article_container = 'div';
                    }
            Severity: Major
            Found in assets/js/frontend/auto-load-next-post.dev.js - About 4 hrs to fix

              File class-alnp-customizer.php has 332 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * Auto Load Next Post: Theme Customizer
               *
               * @since    1.5.0
              Severity: Minor
              Found in includes/customizer/class-alnp-customizer.php - About 4 hrs to fix

                Method add_help_tabs has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public function add_help_tabs() {
                            $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-help.php - About 3 hrs to fix

                  Function alnp_get_theme_support has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                      function alnp_get_theme_support( $prop = '', $default = null ) {
                          $theme_support = get_theme_support( 'auto-load-next-post' );
                          $theme_support = is_array( $theme_support ) ? $theme_support[0] : false;
                  
                          if ( ! $theme_support ) {
                  Severity: Minor
                  Found in includes/auto-load-next-post-conditional-functions.php - About 3 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

                  File Gruntfile.js has 318 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module.exports = function(grunt) {
                      'use strict';
                  
                      var sass = require( 'node-sass' );
                  
                  
                  Severity: Minor
                  Found in Gruntfile.js - About 3 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language