scholarslab/ivanhoe

View on GitHub
javascripts/infinite-scroll/wordpress-plugin/includes/presets.php

Summary

Maintainability
D
2 days
Test Coverage

File presets.php has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Infinite Scroll Presets Interface
 *
 * Stores theme-specific presets for CSS Selectors to aid with setup. Pulls community presets from CSV
Severity: Minor
Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.php - About 4 hrs to fix

    Infinite_Scroll_Presets has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Infinite_Scroll_Presets {
    
        private $parent;
    //    public $preset_url        = 'http://plugins.svn.wordpress.org/infinite-scroll/branches/PresetDB/presets.csv';
        public $preset_url          = 'https://raw.github.com/benbalter/Infinite-Scroll/presetDB/presets.csv';
    Severity: Minor
    Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.php - About 3 hrs to fix

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

          function prepare_items() {
              global $infinite_scroll;
      
              $per_page = 25;
      
      
      Severity: Minor
      Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.php - About 1 hr to fix

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

            function parse_csv( $data ) {
            
                if ( is_string( $data ) )
                    $data = explode( "\n", $data );
                
        Severity: Minor
        Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.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_name has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            function get_name( $stylesheet ) {
            
                //3.4+
                if ( function_exists( 'wp_get_theme' ) ) {
                    
        Severity: Minor
        Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.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_preset has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            function get_preset( $theme = null ) {
            
                if ( $theme == null )
                    $theme = get_stylesheet();
                    
        Severity: Minor
        Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.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 get_preset has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function get_preset( $theme = null ) {
            
                if ( $theme == null )
                    $theme = get_stylesheet();
                    
        Severity: Minor
        Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.php - About 1 hr to fix

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

              function get_stylesheet( $name ) {
              
                  //pre 3.4
                  if ( !function_exists( 'wp_get_themes' ) ) {
                  
          Severity: Minor
          Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.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 prepare_items has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              function prepare_items() {
                  global $infinite_scroll;
          
                  $per_page = 25;
          
          
          Severity: Minor
          Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.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 export has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              function export( $all = false ) {
              
                  $presets = array();
                  
                  //if the current theme is not a known preset or they want all
          Severity: Minor
          Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.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

          Avoid too many return statements within this method.
          Open

                      return false;
          Severity: Major
          Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return false;
            Severity: Major
            Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $preset;
              Severity: Major
              Found in javascripts/infinite-scroll/wordpress-plugin/includes/presets.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status