seb86/Auto-Load-Next-Post

View on GitHub

Showing 88 of 140 total issues

Method add_notices has 41 lines of code (exceeds 25 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 1 hr to fix

    Function output has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

            public function output( $current_view ) {
                if ( $current_view !== 'setup-wizard' ) {
                    return;
                }
    
    
    Severity: Minor
    Found in includes/admin/class-alnp-setup-wizard.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_remove_widgets_panel has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

            public function alnp_remove_widgets_panel( $components ) {
                if ( $this->alnp_is_customizer() ) {
                    foreach( $components as $key => $component ) {
                        if ( $component == 'widgets' ) {
                            unset( $components[ 'widgets' ] );
    Severity: Minor
    Found in includes/customizer/class-alnp-customizer.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_load_content has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        function alnp_load_content( $post_type, $post_format ) {
            // Returns template location for supported themes.
            $template_location = alnp_template_location();
    
            $content_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

    Function scan_theme_selectors has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function scan_theme_selectors( timeout ) {
            $.get( params.random_page, function( response ) {
                if ( ! response ) {
                    return;
                }
    Severity: Minor
    Found in assets/js/admin/scanner.js - About 1 hr to fix

      Method auto_load_next_post_seconds_to_words has 36 lines of code (exceeds 25 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 1 hr to fix

        Function dont_bug_me has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

                public function dont_bug_me() {
                    global $current_user;
        
                    $user_hidden_notice = false;
        
        
        Severity: Minor
        Found in includes/admin/class-alnp-admin-notices.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_option has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

                public static function get_option( $option_name, $default = '' ) {
                    // Array value
                    if ( strstr( $option_name, '[' ) ) {
                        parse_str( $option_name, $option_array );
        
        
        Severity: Minor
        Found in includes/admin/class-alnp-admin-settings.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

        Method render_content has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public function render_content() {
                    ?>
                    <span class="customize-control-title"><?php echo $this->label; ?></span>
        
                    <p>
        Severity: Minor
        Found in includes/customizer/class-alnp-pro-preview-controller.php - About 1 hr to fix

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

                  public function get_settings() {
                      return apply_filters(
                          'alnp_event_settings', array(
          
                              array(
          Severity: Minor
          Found in includes/admin/settings/class-alnp-settings-events.php - About 1 hr to fix

            Function find_template_location has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function find_template_location() {
                    var $data = {
                        action: 'alnp_find_template_location',
                    };
            
            
            Severity: Minor
            Found in assets/js/admin/scanner.js - About 1 hr to fix

              Function create_options has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                      public static function create_options() {
                          // Include settings so that we can run through defaults
                          include_once( dirname( __FILE__ ) . '/admin/class-alnp-admin-settings.php' );
              
                          $settings = ALNP_Admin_Settings::get_settings_pages();
              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 no_theme_selectors_set has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                      public static function no_theme_selectors_set() {
                          $set_selectors = array();
              
                          $content_container    = get_option( 'auto_load_next_post_content_container' );
                          $title_selector       = get_option( 'auto_load_next_post_title_selector' );
              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

              Method alnp_enqueue_scripts has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public function alnp_enqueue_scripts() {
                          // Prevent enqueue scripts if feed, trackback or a preview of a post.
                          if ( is_feed() || is_trackback() || is_preview() ) {
                              return;
                          }
              Severity: Minor
              Found in auto-load-next-post.php - About 1 hr to fix

                Method alnp_get_theme_support has 26 lines of code (exceeds 25 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 1 hr to fix

                  Method alnp_load_content has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function alnp_load_content( $post_type, $post_format ) {
                          // Returns template location for supported themes.
                          $template_location = alnp_template_location();
                  
                          $content_found = false;
                  Severity: Minor
                  Found in includes/auto-load-next-post-template-functions.php - About 1 hr to fix

                    Function set_js_in_footer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                            private static function set_js_in_footer() {
                                if ( is_alnp_supported() ) {
                                    $load_js_in_footer = alnp_get_theme_support( 'load_js_in_footer' );
                                    $lock_js_in_footer = alnp_get_theme_support( 'lock_js_in_footer' );
                    
                    
                    Severity: Minor
                    Found in includes/class-alnp-install.php - About 55 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_enqueue_scripts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                            public function alnp_enqueue_scripts() {
                                // Prevent enqueue scripts if feed, trackback or a preview of a post.
                                if ( is_feed() || is_trackback() || is_preview() ) {
                                    return;
                                }
                    Severity: Minor
                    Found in auto-load-next-post.php - About 55 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 show_messages has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                            public static function show_messages() {
                                if ( count( self::$errors ) > 0 ) {
                                    foreach ( self::$errors as $error ) {
                                        echo '<div class="notice notice-error"><p><strong>' . esc_html( $error ) . '</strong></p></div>';
                                    }
                    Severity: Minor
                    Found in includes/admin/class-alnp-admin-settings.php - About 55 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 exports has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = function(grunt) {
                        'use strict';
                    
                        var sass = require( 'node-sass' );
                    
                    
                    Severity: Minor
                    Found in Gruntfile.js - About 55 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