modxcms/revolution

View on GitHub

Showing 7,873 of 7,873 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 core/model/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

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

        Smarty $smarty,
        $extension,
        $force_compile,
        $time_limit,
        $max_errors,

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

        public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree)
        {
            $last_subtree = count($this->subtrees) - 1;
            if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag
                && $this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level
    Severity: Minor
    Found in core/model/smarty/sysplugins/smarty_internal_parsetree_dq.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 to_smarty_php has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function to_smarty_php(Smarty_Internal_Templateparser $parser)
        {
            $code = '';
            foreach ($this->subtrees as $subtree) {
                if ($code !== '') {
    Severity: Minor
    Found in core/model/smarty/sysplugins/smarty_internal_parsetree_dq.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 _getDefaultTemplate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function _getDefaultTemplate(Smarty_Template_Source $source)
        {
            if ($source->isConfig) {
                $default_handler = $source->smarty->default_config_handler_func;
            } else {

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

        public function writeCachedContent(Smarty_Internal_Template $_template, $content)
        {
            if ($_template->smarty->ext->_writeFile->writeFile(
                    $_template->cached->filepath,
                    $content,
    Severity: Minor
    Found in core/model/smarty/sysplugins/smarty_internal_cacheresource_file.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 core/model/phpthumb/phpthumb.bmp.php - About 45 mins to fix

      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].'" ', ' -'.$IMresizeParameter.' '.phpthumb_functions::escapeshellarg_replacement(($matches[1] - (2 * $width)).'x'.($matches[2] - (2 * $width))).' ', $commandline);
                                              }
      Severity: Major
      Found in core/model/phpthumb/phpthumb.class.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 core/model/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 core/model/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 core/model/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 core/model/phpthumb/phpthumb.bmp.php - About 45 mins to fix

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

                    public function ImageMagickWhichConvert() {
                        static $WhichConvert = null;
                        if (null === $WhichConvert) {
                            if ($this->iswindows) {
                                $WhichConvert = false;
                Severity: Minor
                Found in core/model/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

                                                    for ($i = 0; $i < $firstbyte; $i++) {
                                                        $col = $pixelcounter % $thisfile_bmp_header_raw['width'];
                                                        $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']);
                                                        $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][ $paletteindexes[ $i % 2 ]];
                                                        $pixelcounter++;
                Severity: Major
                Found in core/model/phpthumb/phpthumb.bmp.php - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if (strlen($imgdata) <= $this->maxb) {
                                                  break;
                                              }
                  Severity: Major
                  Found in core/model/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 core/model/phpthumb/phpthumb.bmp.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 core/model/phpthumb/phpthumb.bmp.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                                if (!phpthumb_functions::IsHexColor($color)) {
                                                                    $color = ((!empty($this->bc) && phpthumb_functions::IsHexColor($this->bc)) ? $this->bc : '000000');
                                                                }
                        Severity: Major
                        Found in core/model/phpthumb/phpthumb.class.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 core/model/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 core/model/phpthumb/phpthumb.bmp.php - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language