seb86/Auto-Load-Next-Post

View on GitHub
assets/js/frontend/auto-load-next-post.js

Summary

Maintainability
F
3 days
Test Coverage

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

    Function auto_load_next_post has 55 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.js - About 2 hrs 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

        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

            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

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

                if ( post_url.indexOf( '?p=' ) > -1 ) {
                    np_url = post_url + '&alnp=1';
                } else {
                    var partial_endpoint = 'alnp/';
        
        
        Severity: Major
        Found in assets/js/frontend/auto-load-next-post.js and 1 other location - About 2 hrs to fix
        assets/js/frontend/auto-load-next-post.dev.js on lines 388..397

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

        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 scrollspy() {
                // Do not enter once the initial post has loaded.
                if ( post_count > 0 ) {
                    $( 'hr[data-powered-by="alnp"]' ).on( 'scrollSpy:enter', alnp_enter );
                }
        Severity: Major
        Found in assets/js/frontend/auto-load-next-post.js and 1 other location - About 2 hrs to fix
        assets/js/frontend/auto-load-next-post.dev.js on lines 253..261

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

        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

                                $( 'html, body' ).animate({ scrollTop: (previous_post.offset().top - 100) }, 1000, function() {
                                    $( 'body' ).trigger( 'alnp-previous-post', [ previous_post ] );
                                });
        Severity: Major
        Found in assets/js/frontend/auto-load-next-post.js and 1 other location - About 1 hr to fix
        assets/js/frontend/auto-load-next-post.dev.js on lines 235..237

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

        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

                if ( ( offset.top - scrollTop ) <= 200 && curr_url != this_url ) {
                    curr_url = this_url;
        
                    // Update the History ONLY if we are NOT in the customizer.
                    if ( ! is_customizer ) {
        Severity: Major
        Found in assets/js/frontend/auto-load-next-post.js and 1 other location - About 1 hr to fix
        assets/js/frontend/auto-load-next-post.dev.js on lines 311..320

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

        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_enter() {
                var divider = $(this);
        
                $( 'body' ).trigger( 'alnp-enter', [ divider ] );
        
        
        Severity: Major
        Found in assets/js/frontend/auto-load-next-post.js and 1 other location - About 1 hr to fix
        assets/js/frontend/auto-load-next-post.dev.js on lines 281..289

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

        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

                if ( remove_comments === 'yes' ) {
                    $( comments_container ).remove();
        
                    // Remove Disqus comments if found.
                    if ( $( '#disqus_thread' ).length > 0 ) {
        Severity: Major
        Found in assets/js/frontend/auto-load-next-post.js and 1 other location - About 1 hr to fix
        assets/js/frontend/auto-load-next-post.js on lines 365..372

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

        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

                    if ( remove_comments === 'yes' ) {
                        $( comments_container ).remove();
        
                        // Remove Disqus comments if found.
                        if ( $( '#disqus_thread' ).length > 0 ) {
        Severity: Major
        Found in assets/js/frontend/auto-load-next-post.js and 1 other location - About 1 hr to fix
        assets/js/frontend/auto-load-next-post.js on lines 101..108

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

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

                $( 'body' ).on( 'mousewheel', function( e ) {
                    scroll_up = e.originalEvent.wheelDelta > 0;
                });
        Severity: Minor
        Found in assets/js/frontend/auto-load-next-post.js and 1 other location - About 30 mins to fix
        assets/js/frontend/auto-load-next-post.dev.js on lines 197..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 45.

        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

        There are no issues that match your filters.

        Category
        Status