seb86/Auto-Load-Next-Post

View on GitHub

Showing 88 of 140 total issues

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

Method load_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        public static function load_file( $name, $file_path, $is_script = false, $support = array(), $version = '', $footer = false ) {
Severity: Minor
Found in auto-load-next-post.php - About 45 mins to fix

    Function output has a Cognitive Complexity of 8 (exceeds 5 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 45 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 admin_scripts has a Cognitive Complexity of 8 (exceeds 5 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: Minor
    Found in includes/admin/class-alnp-admin-assets.php - About 45 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 is_theme_supported has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            public static function is_theme_supported() {
                if ( is_alnp_supported() ) {
                    $plugin_supported = alnp_get_theme_support( 'plugin_support' );
    
                    // Is the theme supported by theme or plugin?
    Severity: Minor
    Found in includes/admin/settings/class-alnp-settings-theme-selectors.php - About 35 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_is_bot_user_agent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        function alnp_is_bot_user_agent( $ua = null ) {
            if ( empty( $ua ) ) {
                return false;
            }
    
    
    Severity: Minor
    Found in includes/auto-load-next-post-conditional-functions.php - About 35 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 redirect_getting_started has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            public static function redirect_getting_started( $plugin ) {
                // Prevent redirect if plugin name does not match.
                if ( $plugin !== plugin_basename( AUTO_LOAD_NEXT_POST_FILE ) ) {
                    return;
                }
    Severity: Minor
    Found in includes/class-alnp-install.php - About 35 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 autoload has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            public function autoload( $class ) {
                $class = strtolower( $class );
    
                if ( 0 !== strpos( $class, 'alnp_' ) ) {
                    return;
    Severity: Minor
    Found in includes/class-alnp-autoloader.php - About 35 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 reset_alnp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            public static function reset_alnp() {
                if ( current_user_can( 'install_plugins' ) && isset( $_GET['reset-alnp'] ) && $_GET['reset-alnp'] == 'yes' ) {
                    global $wpdb;
    
                    // If we made it till here nothing is running yet, lets set the transient now for two minutes.
    Severity: Minor
    Found in includes/class-alnp-install.php - About 35 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

    Avoid too many return statements within this method.
    Open

                return true;
    Severity: Major
    Found in includes/customizer/class-alnp-customizer.php - About 30 mins to fix

      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

              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

                    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
                          Severity
                          Category
                          Status
                          Source
                          Language