scholarslab/ivanhoe

View on GitHub

Showing 44 of 71 total issues

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

    function validate( $options ) {

        //add slashes to JS selectors
        $js = array ( 'nextSelector', 'navSelector', 'itemSelector', 'contentSelector' );
        foreach ( $js as $field ) {
Severity: Minor
Found in javascripts/infinite-scroll/wordpress-plugin/includes/options.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

Function infscr_determinepath has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _determinepath: function infscr_determinepath(path) {

            var opts = this.options;

            // if behavior is defined and this function is extended, call that instead of default

    Method ivanhoe_role_id_save_meta_box_data has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function ivanhoe_role_id_save_meta_box_data($post_id=null)
    {
        $post_id = (is_null($post_id)) ? get_post()->ID : $post_id;
    
        /*
    Severity: Minor
    Found in includes/post_meta.php - About 1 hr to fix

      Method ivanhoe_move_source_save_meta_box_data has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function ivanhoe_move_source_save_meta_box_data($post_id=null)
      {
          $post_id = (is_null($post_id)) ? get_post()->ID : $post_id;
      
          /*
      Severity: Minor
      Found in includes/post_meta.php - About 1 hr to fix

        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

          Method add_rationale has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function add_rationale($post)
              {
                  $journal_entry = null;
          
                  if ($this->rationale) {
          Severity: Minor
          Found in includes/post_form/BasePostForm.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 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

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

                function send_to_editor( $args ) {
                    global $wpdb;
                    if (isset($GLOBALS['HTTP_POST_FILES']['async-upload'])){
                        if ( $args['errors'] !== null )
                            return $args;
            Severity: Minor
            Found in javascripts/infinite-scroll/wordpress-plugin/includes/admin.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

            Avoid deeply nested control flow statements.
            Open

                            <?php if ( $characters->have_posts() ) : ?>
                                <ul class='character_list'>
                                    <?php while ( $characters->have_posts() ) : $characters->the_post();
                                        if ($post->ID == $role->ID) continue; ?>
                                            <li class='role'>
            Severity: Major
            Found in single-ivanhoe_game.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if ( $role !== FALSE ) :
              
                              ?>
                              <?php $ivanhoe_post_id=$post->ID; ?>
                              <span class="new_source btn" data-title="<?php echo get_the_title($ivanhoe_post_id); ?>" data-value="<?php echo $ivanhoe_post_id; ?>">Add to Moves</span>
              Severity: Major
              Found in single-ivanhoe_game.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    <?php while ( $characters->have_posts() ) : $characters->the_post(); ?>
                                        <li class='role'>
                                            <a href="<?php echo get_permalink( $post->ID ); ?>" class="image-container"><?php echo get_the_post_thumbnail($post->ID, 'medium'); ?></a>
                                            <a href="<?php echo get_permalink( $post->ID ); ?>"><?php echo $post->post_title; ?></a>
                                        </li>
                Severity: Major
                Found in single-ivanhoe_game.php - About 45 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return path;

                    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

                        Avoid too many return statements within this method.
                        Open

                                return;
                        Severity: Major
                        Found in includes/post_meta.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return;
                          Severity: Major
                          Found in includes/post_meta.php - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language