seb86/Auto-Load-Next-Post

View on GitHub

Showing 140 of 140 total issues

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

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

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

Severity: Major
Found in assets/js/frontend/auto-load-next-post.dev.js and 1 other location - About 1 hr to fix
assets/js/frontend/auto-load-next-post.js on lines 236..244

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

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

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

      <?php
      /**
       * Auto Load Next Post Theme Support: Storefront
       *
       * Applies support for WooCommerce Storefront Theme.
      Severity: Major
      Found in includes/theme-support/class-alnp-storefront.php and 5 other locations - About 1 hr to fix
      includes/theme-support/class-alnp-sydney.php on lines 1..55
      includes/theme-support/class-alnp-twentyfifteen.php on lines 1..55
      includes/theme-support/class-alnp-twentyfourteen.php on lines 1..55
      includes/theme-support/class-alnp-twentyseventeen.php on lines 1..55
      includes/theme-support/class-alnp-twentysixteen.php on lines 1..55

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

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

      <?php
      /**
       * Auto Load Next Post Theme Support: Twenty Sixteen
       *
       * Applies support for WordPress Twenty Sixteen Theme.
      Severity: Major
      Found in includes/theme-support/class-alnp-twentysixteen.php and 5 other locations - About 1 hr to fix
      includes/theme-support/class-alnp-storefront.php on lines 1..55
      includes/theme-support/class-alnp-sydney.php on lines 1..55
      includes/theme-support/class-alnp-twentyfifteen.php on lines 1..55
      includes/theme-support/class-alnp-twentyfourteen.php on lines 1..55
      includes/theme-support/class-alnp-twentyseventeen.php on lines 1..55

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

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

      <?php
      /**
       * Auto Load Next Post Theme Support: Twenty Fourteen
       *
       * Applies support for WordPress Twenty Fourteen Theme.
      Severity: Major
      Found in includes/theme-support/class-alnp-twentyfourteen.php and 5 other locations - About 1 hr to fix
      includes/theme-support/class-alnp-storefront.php on lines 1..55
      includes/theme-support/class-alnp-sydney.php on lines 1..55
      includes/theme-support/class-alnp-twentyfifteen.php on lines 1..55
      includes/theme-support/class-alnp-twentyseventeen.php on lines 1..55
      includes/theme-support/class-alnp-twentysixteen.php on lines 1..55

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

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

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

        <?php
        /**
         * Auto Load Next Post Theme Support: Twenty Seventeen
         *
         * Applies support for WordPress Twenty Seventeen Theme.
        Severity: Major
        Found in includes/theme-support/class-alnp-twentyseventeen.php and 5 other locations - About 1 hr to fix
        includes/theme-support/class-alnp-storefront.php on lines 1..55
        includes/theme-support/class-alnp-sydney.php on lines 1..55
        includes/theme-support/class-alnp-twentyfifteen.php on lines 1..55
        includes/theme-support/class-alnp-twentyfourteen.php on lines 1..55
        includes/theme-support/class-alnp-twentysixteen.php on lines 1..55

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

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

        <?php
        /**
         * Auto Load Next Post Theme Support: Twenty Fifteen
         *
         * Applies support for WordPress Twenty Fifteen Theme.
        Severity: Major
        Found in includes/theme-support/class-alnp-twentyfifteen.php and 5 other locations - About 1 hr to fix
        includes/theme-support/class-alnp-storefront.php on lines 1..55
        includes/theme-support/class-alnp-sydney.php on lines 1..55
        includes/theme-support/class-alnp-twentyfourteen.php on lines 1..55
        includes/theme-support/class-alnp-twentyseventeen.php on lines 1..55
        includes/theme-support/class-alnp-twentysixteen.php on lines 1..55

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

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

        <?php
        /**
         * Auto Load Next Post Theme Support: Sydney
         *
         * Applies support for aThemes Sydney Theme.
        Severity: Major
        Found in includes/theme-support/class-alnp-sydney.php and 5 other locations - About 1 hr to fix
        includes/theme-support/class-alnp-storefront.php on lines 1..55
        includes/theme-support/class-alnp-twentyfifteen.php on lines 1..55
        includes/theme-support/class-alnp-twentyfourteen.php on lines 1..55
        includes/theme-support/class-alnp-twentyseventeen.php on lines 1..55
        includes/theme-support/class-alnp-twentysixteen.php on lines 1..55

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

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

          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

            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

            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 admin_styles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function admin_styles() {
                        $screen    = get_current_screen();
                        $screen_id = $screen ? $screen->id : '';
            
                        if ( in_array( $screen_id, alnp_get_admin_screens() ) ) {
            Severity: Minor
            Found in includes/admin/class-alnp-admin-assets.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

            Severity
            Category
            Status
            Source
            Language