seb86/Auto-Load-Next-Post

View on GitHub

Showing 88 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

      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

        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

                    Function add_notices has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                    Open

                            public function add_notices() {
                                global $current_user;
                    
                                // If the current user can not install plugins then return nothing!
                                if ( ! current_user_can( 'install_plugins' ) ) {
                    Severity: Minor
                    Found in includes/admin/class-alnp-admin-notices.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

                    Method alnp_get_customizer_controls has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            public function alnp_get_customizer_controls() {
                                /**
                                 * Filter Customizer controls for Auto Load Next Post.
                                 *
                                 * @param array $controls Customizer controls to add.
                    Severity: Major
                    Found in includes/customizer/class-alnp-customizer.php - About 3 hrs to fix

                      Method alnp_get_customizer_settings has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              public function alnp_get_customizer_settings() {
                                  $settings = $this->alnp_get_settings();
                      
                                  /**
                                   * Filter Customizer settings for Auto Load Next Post.
                      Severity: Major
                      Found in includes/customizer/class-alnp-customizer.php - About 3 hrs to fix

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

                                public static function save_fields( $options ) {
                                    if ( empty( $_POST ) ) {
                                        return false;
                                    }
                        
                        
                        Severity: Major
                        Found in includes/admin/class-alnp-admin-settings.php - About 3 hrs to fix

                          Function auto_load_next_post has 80 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.dev.js - About 3 hrs to fix

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

                                function run_alnp() {
                                    if ( $( 'article' ).length <= 0 ) {
                                        article_container = 'div';
                                    }
                            
                            
                            Severity: Major
                            Found in assets/js/frontend/auto-load-next-post.js - About 2 hrs to fix

                              File auto-load-next-post.dev.js has 282 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              // Variables
                              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,
                              Severity: Minor
                              Found in assets/js/frontend/auto-load-next-post.dev.js - About 2 hrs to fix

                                Function alnp_scan_directories has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    function alnp_scan_directories( $post_type = 'post', $post_format = '' ) {
                                        // Possible locations where the content files are found.
                                        $locations = alnp_get_locations();
                                
                                        // Templates to look for based on the post that is loaded.
                                Severity: Minor
                                Found in includes/auto-load-next-post-template-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

                                Severity
                                Category
                                Status
                                Source
                                Language