ecoco/magento_profiler

View on GitHub

Showing 241 of 241 total issues

Function getRewriteConflicts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRewriteConflicts()
    {
        $conflicts = [];
        $rewrites  = $this->loadRewrites();
        foreach ($rewrites as $type => $data) {
Severity: Minor
Found in app/code/community/Ecocode/Profiler/Helper/Rewrite.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 collect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function collect(
        Mage_Core_Controller_Request_Http $request,
        Mage_Core_Controller_Response_Http $response,
        \Exception $exception = null
    )

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 prepareQueryData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function prepareQueryData()
    {
        $this->queries          = [];
        $this->identicalQueries = [];
        $this->queriesByContext = [];
Severity: Minor
Found in app/code/community/Ecocode/Profiler/Block/Collector/Mysql/Panel.php - About 1 hr to fix

    Method computeErrorsCount has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function computeErrorsCount()
        {
            $logger = $this->getLogger();
            $count  = [
                'total_log_count'   => count($logger->getLogs()),

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

          public function formatQuery($sql, $highlightOnly = false)
          {
              if (@!class_exists('SqlFormatter')) {
                  return 'SqlFormatter is not installed';
              }
      Severity: Minor
      Found in app/code/community/Ecocode/Profiler/Helper/Sql.php - About 1 hr to fix

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

            protected function parseController($controller)
            {
                if (is_object($controller)) {
                    /** @var Mage_Core_Controller_Varien_Front $controller */
        
        

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

              protected function _isInheritanceConflict($classes)
              {
                  $count   = count($classes);
                  $classes = array_reverse($classes);
                  for ($i = 1; $i < $count; $i++) {
          Severity: Minor
          Found in app/code/community/Ecocode/Profiler/Helper/Rewrite.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 formatArgs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function formatArgs($args)
              {
                  $result = [];
                  foreach ($args as $key => $item) {
                      if ('object' === $item[0]) {
          Severity: Minor
          Found in app/code/community/Ecocode/Profiler/Helper/Code.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 getCategory has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              protected static function getCategory($timerName)
              {
                  if (isset(self::$sectionMap[$timerName])) {
                      return self::CATEGORY_SECTION;
                  }
          Severity: Minor
          Found in app/code/community/Ecocode/Profiler/overwrite/VarienProfiler.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 getClassNames has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function getClassNames($reload = false)
              {
                  if ($this->classNameCache !== null && $reload === false) {
                      return $this->classNameCache;
                  }
          Severity: Minor
          Found in app/code/community/Ecocode/Profiler/Helper/Data.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 _addData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _addData($data, $scope, $forceReload = false)
              {
                  $source = debug_backtrace()[1]['function'];
                  if (isset($this->sourceMap[$source])) {
                      $source = $this->sourceMap[$source];
          Severity: Minor
          Found in app/code/community/Ecocode/Profiler/overwrite/MageCoreModelTranslate.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

          Method find has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function find($ip, $url, $limit, $method, $start = null, $end = null, $statusCode = null)
          Severity: Major
          Found in app/code/community/Ecocode/Profiler/Model/Profiler/FileStorage.php - About 50 mins to fix

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

                public function getCookies($format = self::COOKIES_FLAT)
                {
                    if (!in_array($format, [self::COOKIES_FLAT, self::COOKIES_ARRAY])) {
                        throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', [self::COOKIES_FLAT, self::COOKIES_ARRAY])));
                    }
            Severity: Minor
            Found in app/code/community/Ecocode/Profiler/Model/Http/ResponseHeaderBag.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 write has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function write(Ecocode_Profiler_Model_Profile $profile)
                {
                    $file = $this->getFilename($profile->getToken());
            
                    $profileIndexed = is_file($file);
            Severity: Minor
            Found in app/code/community/Ecocode/Profiler/Model/Profiler/FileStorage.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 collect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function collect(Mage_Core_Controller_Request_Http $request, Mage_Core_Controller_Response_Http $response, \Exception $exception = null)
                {
                    $stats = [
                        'load'      => 0,
                        'loop_load' => 0,

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

                protected function createProfileFromData($token, $data, $parent = null)
                {
                    $profile = new Ecocode_Profiler_Model_Profile($token);
                    $profile->setIp($data['ip']);
                    $profile->setMethod($data['method']);
            Severity: Minor
            Found in app/code/community/Ecocode/Profiler/Model/Profiler/FileStorage.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 find has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function find($ip, $url, $limit, $method, $start, $end)
            Severity: Minor
            Found in app/code/community/Ecocode/Profiler/Model/Profiler.php - About 45 mins to fix

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

                  public static function getVersion()
                  {
                      if (self::$version === null && class_exists('Mage') && $config = Mage::getConfig()) {
                          //try to load from magento
                          $config = $config->getModuleConfig('Ecocode_Profiler');
              Severity: Minor
              Found in app/code/community/Ecocode/Profiler/Helper/Data.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 getUserConfig has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getUserConfig($asArray = false)
                  {
                      if (!$this->userConfig || $asArray) {
                          $userConfigFile = $this->getUserConfigFile();
              
              
              Severity: Minor
              Found in app/code/community/Ecocode/Profiler/Model/Config.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 getMenuBlocks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getMenuBlocks()
                  {
                      if (!$this->getProfile()) {
                          return [];
                      }
              Severity: Minor
              Found in app/code/community/Ecocode/Profiler/Block/Profiler/Sidebar/Menu.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

              Severity
              Category
              Status
              Source
              Language