ecoco/magento_profiler

View on GitHub
app/code/community/Ecocode/Profiler/controllers/IndexController.php

Summary

Maintainability
B
4 hrs
Test Coverage

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 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

        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

        Missing class import via use statement (line '130', column '23').
        Open

                    throw new Exception(sprintf('Panel "%s" is not available for token "%s".', $panel, $token));

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '145', column '23').
        Open

                    throw new Exception(sprintf('Panel Block for "%s" is not available for token "%s".', $panel, $token));

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '148', column '23').
        Open

                    throw new Exception(sprintf('Panel Block must extend "Ecocode_Profiler_Block_Collector_AbstractBase"'));

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Avoid assigning values to variables in if clauses and the like (line '120', column '36').
        Open

            public function panelAction()
            {
                $profiler = $this->getProfiler();
        
                /** @var Mage_Core_Controller_Request_Http $request */

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid assigning values to variables in if clauses and the like (line '36', column '13').
        Open

            public function searchAction()
            {
                /** @var Mage_Core_Controller_Request_Http$request */
                $request  = $this->getRequest();
        
        

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid assigning values to variables in if clauses and the like (line '124', column '14').
        Open

            public function panelAction()
            {
                $profiler = $this->getProfiler();
        
                /** @var Mage_Core_Controller_Request_Http $request */

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        There are no issues that match your filters.

        Category
        Status