mambax7/pedigree

View on GitHub

Showing 702 of 1,100 total issues

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

    public function deInterlace()
    {
        $data = $this->m_data;
        $s    = 0;
        $y    = 0;
Severity: Minor
Found in phpthumb/phpthumb.gif.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 (($pixeldataoffset % 4) != 0) {
                                    // lines are padded to nearest DWORD
                                    $pixeldataoffset++;
                                }
Severity: Major
Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                    while (($pixeldataoffset % 4) != 0) {
                                        // lines are padded to nearest DWORD
                                        $pixeldataoffset++;
                                    }
    Severity: Major
    Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                      for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
                                          $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData[$pixeldataoffset + 3]) << 24) | (ord($BMPpixelData[$pixeldataoffset + 2]) << 16) | (ord($BMPpixelData[$pixeldataoffset + 1]) << 8) | ord($BMPpixelData[$pixeldataoffset]);
                                          $pixeldataoffset                  += 4;
                                      }
      Severity: Major
      Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    for ($y = 0; $y < $this->thumbnail_height; $y++) {
                                        $AlphaChannelPixel = phpthumb_functions::GetPixelColor($img_alpha_mixdown_dither, $x, $y);
                                        if ($AlphaChannelPixel['red'] > 127) {
                                            imagesetpixel($this->gdimg_output, $x, $y, $TransparentColor);
                                        }
        Severity: Major
        Found in 0old/phpthumb/phpthumb.class.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if (mb_strlen($imgdata) <= $this->maxb) {
                                          imagetruecolortopalette($this->gdimg_output, true, 2 ** $i);
                                          break;
                                      }
          Severity: Major
          Found in 0old/phpthumb/phpthumb.class.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if (mb_strlen($imgdata) <= $this->maxb) {
                                            break;
                                        }
            Severity: Major
            Found in 0old/phpthumb/phpthumb.class.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                              while (($pixeldataoffset % 4) != 0) {
                                                  // lines are padded to nearest DWORD
                                                  $pixeldataoffset++;
                                              }
              Severity: Major
              Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
                                                    $paletteindex                     = ord($BMPpixelData[$pixeldataoffset++]);
                                                    $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
                                                }
                Severity: Major
                Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                  for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
                                                      $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData[$pixeldataoffset + 2]) << 16) | (ord($BMPpixelData[$pixeldataoffset + 1]) << 8) | ord($BMPpixelData[$pixeldataoffset]);
                                                      $pixeldataoffset                  += 3;
                                                  }
                  Severity: Major
                  Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

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

                        public static function lettersChoice($myObject, $activeObject, $criteria, $name, $link, $link2 = null)
                    Severity: Minor
                    Found in 0old/pedigreeUtilities0.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                      while (($pixeldataoffset % 4) != 0) {
                                                          // lines are padded to nearest DWORD
                                                          $pixeldataoffset++;
                                                      }
                      Severity: Major
                      Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                        while (($pixeldataoffset % 4) != 0) {
                                                            // lines are padded to nearest DWORD
                                                            $pixeldataoffset++;
                                                        }
                        Severity: Major
                        Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                          for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) {
                                                              $paletteindexbyte = ord($BMPpixelData[$pixeldataoffset++]);
                                                              for ($i = 7; $i >= 0; $i--) {
                                                                  $paletteindex                     = ($paletteindexbyte & (0x01 << $i)) >> $i;
                                                                  $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
                          Severity: Major
                          Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                            for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) {
                                                                $paletteindexbyte = ord($BMPpixelData[$pixeldataoffset++]);
                                                                for ($i = 1; $i >= 0; $i--) {
                                                                    $paletteindex                     = ($paletteindexbyte & (0x0F << (4 * $i))) >> (4 * $i);
                                                                    $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
                            Severity: Major
                            Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                              for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
                                                                  $pixelvalue      = $this->LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset, $thisfile_bmp_header_raw['bits_per_pixel'] / 8));
                                                                  $pixeldataoffset += $thisfile_bmp_header_raw['bits_per_pixel'] / 8;
                              
                                                                  $red                              = (int)round(((($pixelvalue & $thisfile_bmp_header_raw['red_mask']) >> $redshift) / ($thisfile_bmp_header_raw['red_mask'] >> $redshift)) * 255);
                              Severity: Major
                              Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                            if (strlen($imgdata) <= $this->maxb) {
                                                                imagetruecolortopalette($this->gdimg_output, true, pow(2, $i));
                                                                break;
                                                            }
                                Severity: Major
                                Found in phpthumb/phpthumb.class.php - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                                      switch ($secondbyte) {
                                                                          case 0:
                                                                              // end of line
                                                                              // no need for special processing, just ignore
                                                                              break;
                                  Severity: Major
                                  Found in phpthumb/phpthumb.bmp.php - About 45 mins to fix

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

                                        public function file_exists_ignoreopenbasedir($filename, $cached = true)
                                        {
                                            static $open_basedirs = null;
                                            static $file_exists_cache = [];
                                            if (!$cached || !isset($file_exists_cache[$filename])) {
                                    Severity: Minor
                                    Found in phpthumb/phpthumb.class.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('# \\-crop "([\d]+)x([\d]+)\\+0\\+0" #', $commandline, $matches)) {
                                                                                $commandline = str_replace(' -crop "' . $matches[1] . 'x' . $matches[2] . '+0+0" ', ' -crop ' . phpthumb_functions::escapeshellarg_replacement(($matches[1] - (2 * $width)) . 'x' . ($matches[2] - (2 * $width)) . '+0+0') . ' ', $commandline);
                                                                            } elseif (preg_match('# \\-' . $IMresizeParameter . ' "([0-9]+)x([0-9]+)" #', $commandline, $matches)) {
                                                                                $commandline = str_replace(
                                                                                    ' -' . $IMresizeParameter . ' "' . $matches[1] . 'x' . $matches[2] . '" ',
                                    Severity: Major
                                    Found in phpthumb/phpthumb.class.php - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language