seb86/Auto-Load-Next-Post

View on GitHub

Showing 140 of 140 total issues

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

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

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

    function alnp_leave() {
        var divider = $(this);

        $( 'body' ).trigger( 'alnp-leave', [ divider ] );

Severity: Minor
Found in assets/js/frontend/auto-load-next-post.js and 1 other location - About 50 mins to fix
assets/js/frontend/auto-load-next-post.dev.js on lines 292..298

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

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 alnp_leave() {
        var divider = $(this);

        $( 'body' ).trigger( 'alnp-leave', [ divider ] );

Severity: Minor
Found in assets/js/frontend/auto-load-next-post.dev.js and 1 other location - About 50 mins to fix
assets/js/frontend/auto-load-next-post.js on lines 247..253

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

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

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

                php: {
                    src: [ '<%= pkg.name %>.php' ],
                    overwrite: true,
                    replacements: [
                        {
    Severity: Minor
    Found in Gruntfile.js and 1 other location - About 40 mins to fix
    Gruntfile.js on lines 301..314

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

    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

                readme: {
                    src: [ 'readme.txt' ],
                    overwrite: true,
                    replacements: [
                        {
    Severity: Minor
    Found in Gruntfile.js and 1 other location - About 40 mins to fix
    Gruntfile.js on lines 287..300

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

    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 5 locations. Consider refactoring.
    Open

                if ( tab == 'license' ) {
                    setTimeout(function () {
                        jc.setContentAppend( '<p>' + params.i18n_license_content + '</p>' );
                    }, 100);
                }
    Severity: Major
    Found in assets/js/admin/pro-preview.js and 4 other locations - About 35 mins to fix
    assets/js/admin/pro-preview.js on lines 23..27
    assets/js/admin/pro-preview.js on lines 29..33
    assets/js/admin/pro-preview.js on lines 35..39
    assets/js/admin/pro-preview.js on lines 41..45

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

    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 5 locations. Consider refactoring.
    Open

                if ( tab == 'load-and-scroll' ) {
                    setTimeout(function () {
                        jc.setContentAppend( '<p>' + params.i18n_load_scroll_content + '</p>' );
                    }, 100);
                }
    Severity: Major
    Found in assets/js/admin/pro-preview.js and 4 other locations - About 35 mins to fix
    assets/js/admin/pro-preview.js on lines 23..27
    assets/js/admin/pro-preview.js on lines 35..39
    assets/js/admin/pro-preview.js on lines 41..45
    assets/js/admin/pro-preview.js on lines 47..51

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

    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 5 locations. Consider refactoring.
    Open

                if ( tab == 'restrictions' ) {
                    setTimeout(function () {
                        jc.setContentAppend( '<p>' + params.i18n_restrictions_content + '</p>' );
                    }, 100);
                }
    Severity: Major
    Found in assets/js/admin/pro-preview.js and 4 other locations - About 35 mins to fix
    assets/js/admin/pro-preview.js on lines 23..27
    assets/js/admin/pro-preview.js on lines 29..33
    assets/js/admin/pro-preview.js on lines 41..45
    assets/js/admin/pro-preview.js on lines 47..51

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

    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 5 locations. Consider refactoring.
    Open

                if ( tab == 'comments' ) {
                    setTimeout(function () {
                        jc.setContentAppend( '<p>' + params.i18n_comments_content + '</p>' );
                    }, 100);
                }
    Severity: Major
    Found in assets/js/admin/pro-preview.js and 4 other locations - About 35 mins to fix
    assets/js/admin/pro-preview.js on lines 29..33
    assets/js/admin/pro-preview.js on lines 35..39
    assets/js/admin/pro-preview.js on lines 41..45
    assets/js/admin/pro-preview.js on lines 47..51

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

    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 5 locations. Consider refactoring.
    Open

                if ( tab == 'query' ) {
                    setTimeout(function () {
                        jc.setContentAppend( '<p>' + params.i18n_query_content + '</p>' );
                    }, 100);
                }
    Severity: Major
    Found in assets/js/admin/pro-preview.js and 4 other locations - About 35 mins to fix
    assets/js/admin/pro-preview.js on lines 23..27
    assets/js/admin/pro-preview.js on lines 29..33
    assets/js/admin/pro-preview.js on lines 35..39
    assets/js/admin/pro-preview.js on lines 47..51

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

    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

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