ecoco/magento_profiler

View on GitHub

Showing 241 of 241 total issues

Method collect has 37 lines of code (exceeds 25 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,

    Method collectEvents has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function collectEvents(Ecocode_Profiler_Model_AppDev $app)
        {
            $eventList = $app->getFiredEvents();
            $events    = [];
    
    

      Method collect has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function collect(Mage_Core_Controller_Request_Http $request, Mage_Core_Controller_Response_Http $response, \Exception $exception = null)
          {
              $responseHeaders = $this->collectResponseHeaders($response);
              // attributes are serialized and as they can be anything, they need to be converted to strings.
              $requestAttributes = $this->collectRequestAttributes($request);

        Method find has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function find($ip, $url, $limit, $method, $start = null, $end = null, $statusCode = null)
            {
                $file = $this->getIndexFilename();
        
                if (!file_exists($file)) {
        Severity: Minor
        Found in app/code/community/Ecocode/Profiler/Model/Profiler/FileStorage.php - About 1 hr to fix

          Method sanitizeLogs has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function sanitizeLogs($logs)
              {
                  $errorContextById = [];
                  $sanitizedLogs    = [];
          
          

            Consider simplifying this complex logical expression.
            Open

                        if ($ip && false === strpos($csvIp, $ip) || $url && false === strpos($csvUrl, $url) || $method && false === strpos($csvMethod, $method) || $statusCode && false === strpos($csvStatusCode, $statusCode)) {
                            continue;
                        }
            Severity: Critical
            Found in app/code/community/Ecocode/Profiler/Model/Profiler/FileStorage.php - About 1 hr to fix

              Method getCategory has 33 lines of code (exceeds 25 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 1 hr to fix

                Method loadRewrites has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function loadRewrites()
                    {
                        if ($this->_rewrites === null) {
                            $files     = ['config.xml', 'development.xml'];
                            $prototype = $this->_rewriteTypes;
                Severity: Minor
                Found in app/code/community/Ecocode/Profiler/Helper/Rewrite.php - About 1 hr to fix

                  Function getLogGroups has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getLogGroups()
                      {
                          if ($this->logGroups === null) {
                              $logGroups = [
                                  'deprecation'    => [],
                  Severity: Minor
                  Found in app/code/community/Ecocode/Profiler/Block/Collector/Log/Panel.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 computeErrorsCount has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

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

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

                      protected function readLineFromFile($file)
                      {
                          $line     = '';
                          $position = ftell($file);
                  
                  
                  Severity: Minor
                  Found in app/code/community/Ecocode/Profiler/Model/Profiler/FileStorage.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

                  Method searchAction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function searchAction()
                      {
                          /** @var Mage_Core_Controller_Request_Http$request */
                          $request  = $this->getRequest();
                  
                  
                  Severity: Minor
                  Found in app/code/community/Ecocode/Profiler/controllers/IndexController.php - About 1 hr to fix

                    Method panelAction has 30 lines of code (exceeds 25 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 1 hr to fix

                      Method collectSessionData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function collectSessionData()
                          {
                              $namespaceData  = [];
                              $storeData      = [];
                              $rawSessionData = $this->getRawSession();

                        Method collect has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Method searchResultsAction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function searchResultsAction()
                              {
                                  /** @var Mage_Core_Controller_Request_Http$request */
                                  $request  = $this->getRequest();
                                  /** @var Ecocode_Profiler_Model_Profiler $profiler */
                          Severity: Minor
                          Found in app/code/community/Ecocode/Profiler/controllers/IndexController.php - About 1 hr to fix

                            Method getRequestJsonData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getRequestJsonData()
                                {
                                    $eventList = $this->getCollector()->getEvents();
                                    $events = [];
                                    foreach ($eventList as $name => $event) {
                            Severity: Minor
                            Found in app/code/community/Ecocode/Profiler/Block/Collector/Time/Panel.php - About 1 hr to fix

                              Method renderNode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function renderNode($node, $prefix = '', $sibling = false)
                                  {
                                      if (!$node['parent_id']) {
                                          $start = $node['name'];
                                      } else {

                                Method collectCacheCallData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

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

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

                                      public function captureFlashMessages()
                                      {
                                          $messages = [];
                                          foreach ($this->getRawSession() as $namespace => $data) {
                                              if (!isset($data['messages'])) {

                                  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