CaffGeek/MBACNationals

View on GitHub

Showing 7,504 of 7,504 total issues

Function wp_register_widget_control has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function wp_register_widget_control($id, $name, $control_callback, $options = array()) {
    global $wp_registered_widget_controls, $wp_registered_widget_updates, $wp_registered_widgets, $_wp_deprecated_widgets_callbacks;

    $id = strtolower($id);
    $id_base = _get_widget_id_base($id);
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/widgets.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

Avoid deeply nested control flow statements.
Open

                                    if ($atom_structure['sample_description_table'][$i]['video_pixel_color_name'] != 'invalid') {
                                        $info['quicktime']['video']['codec_fourcc']        = $atom_structure['sample_description_table'][$i]['data_format'];
                                        $info['quicktime']['video']['codec_fourcc_lookup'] = $this->QuicktimeVideoCodecLookup($atom_structure['sample_description_table'][$i]['data_format']);
                                        $info['quicktime']['video']['codec']               = (($atom_structure['sample_description_table'][$i]['video_encoder_name_len'] > 0) ? $atom_structure['sample_description_table'][$i]['video_encoder_name'] : $atom_structure['sample_description_table'][$i]['data_format']);
                                        $info['quicktime']['video']['color_depth']         = $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'];

    Function new_line has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function new_line()
        {
            $this->value = trim($this->value, "\x0D\x20");
            if ($this->name !== '' && $this->value !== '')
            {
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/HTTP/Parser.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

    Avoid deeply nested control flow statements.
    Open

                                            if (!empty($getid3_temp->info['warning'])) {
                                                foreach ($getid3_temp->info['warning'] as $newerror) {
                                                    $this->warning('getid3_dts() says: ['.$newerror.']');
                                                }
                                            }
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.riff.php - About 45 mins to fix

      Function get_enclosed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function get_enclosed($post_id) {
          $custom_fields = get_post_custom( $post_id );
          $pung = array();
          if ( !is_array( $custom_fields ) )
              return $pung;
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/post.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

      Avoid deeply nested control flow statements.
      Open

                          while ( false !== $file = readdir($dh) ) {
                              $file = basename($file);
                              if ( substr($file, 0, 1) == '.' )
                                  continue;
                              if ( !in_array(strtolower(substr($file, -4)), array('.png', '.gif', '.jpg') ) ) {
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/post.php - About 45 mins to fix

        Function compress has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function compress($ip)
            {
                // Prepare the IP to be compressed
                $ip = self::uncompress($ip);
                $ip_parts = self::split_v6_v4($ip);
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Net/IPv6.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

        Avoid deeply nested control flow statements.
        Open

                                        if (substr($DIVXTAG, -7) == 'DIVXTAG') {
                                            // DIVXTAG is supposed to be inside an IDVX chunk in a LIST chunk, but some bad encoders just slap it on the end of a file
                                            $this->warning('Found wrongly-structured DIVXTAG at offset '.($this->ftell() - 128).', parsing anyway');
                                            $info['divxtag']['comments'] = self::ParseDIVXTAG($DIVXTAG);
                                            break 2;
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.riff.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                                  if ($chunkname == 'JUNK') {
                                                      if (preg_match('#^([\\x20-\\x7F]+)#', $RIFFchunk[$chunkname][$thisindex]['data'], $matches)) {
                                                          // only keep text characters [chr(32)-chr(127)]
                                                          $info['riff']['comments']['junk'][] = trim($matches[1]);
                                                      }
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.riff.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if (!empty($getid3_temp->info['mpeg'])) {
                                            $info['mpeg'] = $getid3_temp->info['mpeg'];
                                            if (isset($info['mpeg']['audio'])) {
                                                $info['audio']['dataformat']   = 'mp3';
                                                $info['audio']['codec']        = (!empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : (!empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : (!empty($info['mpeg']['audio']['LAME']) ? 'LAME' :'mp3')));

              Function get_lastpostmodified has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function get_lastpostmodified($timezone = 'server') {
                  global $cache_lastpostmodified, $wpdb, $blog_id;
                  $add_seconds_server = date('Z');
                  if ( !isset($cache_lastpostmodified[$blog_id][$timezone]) ) {
                      switch(strtolower($timezone)) {
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/post.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

              Avoid deeply nested control flow statements.
              Open

                                          if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'])) {
                                              $strhData = $thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'];
                                              $strhfccType = substr($strhData,  0, 4);
              
                                              if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'])) {
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.riff.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                    switch ($atom_structure['sample_description_table'][$i]['data_format']) {
                                                        case 'raw ': // PCM
                                                        case 'alac': // Apple Lossless Audio Codec
                                                            $info['audio']['lossless'] = true;
                                                            break;

                  Function get_byteorder has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      function get_byteorder($magic) {
                          // The magic is 0x950412de
                  
                          // bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565
                          $magic_little = (int) - 1794895138;
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/pomo/mo.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

                  Avoid deeply nested control flow statements.
                  Open

                                                  switch ($thisfile_riff_audio['codec_fourcc']) {
                                                      // http://developer.apple.com/qa/snd/snd07.html
                                                      case 'sowt':
                                                          $thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Little-Endian PCM';
                                                          $thisfile_audio['lossless'] = true;
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.riff.php - About 45 mins to fix

                    Method QuicktimeParseAtom has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) {

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (!empty($getid3_temp->info['warning'])) {
                                                      foreach ($getid3_temp->info['warning'] as $value) {
                                                          $info['warning'][] = $value;
                                                      }
                                                  }

                        Function register_sidebars has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function register_sidebars($number = 1, $args = array()) {
                            global $wp_registered_sidebars;
                            $number = (int) $number;
                        
                            if ( is_string($args) )
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-includes/widgets.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 get_iri has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function get_iri()
                            {
                                if (!$this->is_valid())
                                {
                                    return false;
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/IRI.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

                        Avoid deeply nested control flow statements.
                        Open

                                                            if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', $FirstFourBytes)) {
                                                                // MP3
                                                                if (getid3_mp3::MPEGaudioHeaderBytesValid($FirstFourBytes)) {
                                                                    $getid3_temp = new getID3();
                                                                    $getid3_temp->openfile($this->getid3->filename);
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio-video.riff.php - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language