ecoco/magento_profiler

View on GitHub

Showing 84 of 241 total issues

Function panelAction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function panelAction()
    {
        $profiler = $this->getProfiler();

        /** @var Mage_Core_Controller_Request_Http $request */
Severity: Minor
Found in app/code/community/Ecocode/Profiler/controllers/IndexController.php - About 35 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 collectTimingData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function collectTimingData()
    {
        $totalTime = 0;
        foreach ($this->renderLog as &$data) {
            $renderTimeExcl = $data['render_time_incl'];

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

    public function getValue($key, $default = null)
    {
        if (!isset($this->cache[$key])) {
            $keyParts = explode('/', $key);

Severity: Minor
Found in app/code/community/Ecocode/Profiler/Model/Config.php - About 35 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 makeDisposition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function makeDisposition($disposition, $filename, $filenameFallback = '')
    {
        if (!in_array($disposition, [self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE])) {
            throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE));
        }
Severity: Minor
Found in app/code/community/Ecocode/Profiler/Model/Http/ResponseHeaderBag.php - About 35 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 controllerFrontSendResponseBefore has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function controllerFrontSendResponseBefore(Varien_Event_Observer $observer)
    {
        if (!$this->getProfiler()->isEnabled()) {
            return;
        }
Severity: Minor
Found in app/code/community/Ecocode/Profiler/Model/Observer.php - About 35 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;

    Avoid too many return statements within this method.
    Open

                    return sprintf("[\n%s%s\n%s]", $indent, implode(sprintf(", \n%s", $indent), $all), str_repeat('  ', $depth - 1));
    Severity: Major
    Found in app/code/community/Ecocode/Profiler/Helper/ValueExporter.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return sprintf('Resource(%s#%d)', get_resource_type($value), $value);
      Severity: Major
      Found in app/code/community/Ecocode/Profiler/Helper/ValueExporter.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return 'null';
        Severity: Major
        Found in app/code/community/Ecocode/Profiler/Helper/ValueExporter.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return 'false';
          Severity: Major
          Found in app/code/community/Ecocode/Profiler/Helper/ValueExporter.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return false;
            Severity: Major
            Found in app/code/community/Ecocode/Profiler/Helper/Data.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $header;
              Severity: Major
              Found in app/code/community/Ecocode/Profiler/Model/Http/ResponseHeaderBag.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return 'true';
                Severity: Major
                Found in app/code/community/Ecocode/Profiler/Helper/ValueExporter.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return sprintf("[\n%s%s\n]", $indent, implode(sprintf(",\n%s", $indent), $all));
                  Severity: Major
                  Found in app/code/community/Ecocode/Profiler/Helper/ValueExporter.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return $str;
                    Severity: Major
                    Found in app/code/community/Ecocode/Profiler/Helper/ValueExporter.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return (string)$value;
                      Severity: Major
                      Found in app/code/community/Ecocode/Profiler/Helper/ValueExporter.php - About 30 mins to fix

                        Function collectCacheCallData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function collectCacheCallData()
                            {
                                $cache = $this->getCacheInstance();
                                if (!$cache instanceof Ecocode_Profiler_Model_Core_Cache) {
                                    return;

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

                            protected static function fixCodeMarkup($line)
                            {
                                // </span> ending tag from previous line
                                $opening = strpos($line, '<span');
                                $closing = strpos($line, '</span>');
                        Severity: Minor
                        Found in app/code/community/Ecocode/Profiler/Helper/Code.php - About 25 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 shouldRemoveBacktraceItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function shouldRemoveBacktraceItem(array $data, array $ignoreCalls = [], array $ignoreInstanceOf = [])
                            {
                                //remove if not called from a class
                                if (!isset($data['class'], $data['function'])) {
                                    return true;
                        Severity: Minor
                        Found in app/code/community/Ecocode/Profiler/Helper/Data.php - About 25 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 computeCacheControlValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function computeCacheControlValue()
                            {
                                if (!$this->cacheControl && !$this->has('ETag') && !$this->has('Last-Modified') && !$this->has('Expires')) {
                                    return 'no-cache';
                                }
                        Severity: Minor
                        Found in app/code/community/Ecocode/Profiler/Model/Http/ResponseHeaderBag.php - About 25 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

                        Severity
                        Category
                        Status
                        Source
                        Language