vpietri/magento2-developer-quickdevbar

View on GitHub

Showing 185 of 185 total issues

Method getHtmlBlocksHierarchy has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getHtmlBlocksHierarchy($treeBlocks = [], $level = 0)
    {
        if (empty($treeBlocks)) {
            $treeBlocks = [$this->qdbHelperRegister->getLayoutHierarchy()];
        }
Severity: Minor
Found in Block/Tab/Content/Layout.php - About 1 hr to fix

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

        protected function buildTreeBlocks($layout, $name = 'root', $alias = '')
        {
            $element = $this->getElementByName($name);
            if ($element) {
                $treeBlocks = [
    Severity: Minor
    Found in Observer/LayoutGenerateBlocksAfterObserver.php - About 1 hr to fix

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

          public function pullData()
          {
              if ($this->pluginsByTypes === null) {
                  $this->pluginsByTypes =  [];
      
      
      Severity: Minor
      Found in Service/Plugin.php - About 1 hr to fix

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

            public function getWrapperContent($ajax = false)
            {
        //Clean old files
        //        /** @var \SplFileInfo $fileInfo */
        //        foreach (new \DirectoryIterator($this->getQdbTempDir()) as $fileInfo) {
        Severity: Minor
        Found in Helper/Data.php - About 1 hr to fix

          Avoid using undefined variables such as '$cacheEvents' which will lead to PHP notices.
          Open

                  if(empty($cacheEvents[$identifier])) {
          Severity: Minor
          Found in Service/App/Cache.php by phpmd

          UndefinedVariable

          Since: 2.8.0

          Detects when a variable is used that has not been defined before.

          Example

          class Foo
          {
              private function bar()
              {
                  // $message is undefined
                  echo $message;
              }
          }

          Source https://phpmd.org/rules/cleancode.html#undefinedvariable

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

              protected function execute(InputInterface $input, OutputInterface $output)
              {
          
                  $this->resourceConfig->saveConfig('dev/quickdevbar/enable', $this->status);
                  $output->writeln("<info>" . $this->message . "</info>");
          Severity: Minor
          Found in Console/Command/AbstractStatusToolbar.php - About 1 hr to fix

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

                public function pullData()
                {
                    $request = $this->requestHttp;
                    $requestData = [];
                    $requestData[] = ['name' => 'Date sys', 'value' => date("Y-m-d H:i:s")];
            Severity: Minor
            Found in Service/Request.php - About 1 hr to fix

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

                  function tailFile($filepath, $lines = 1, $adaptive = true)
                  {
                      // Open file
                      $f = @fopen($filepath, "rb");
                      if ($f === false) {
              Severity: Minor
              Found in Helper/Data.php - About 1 hr to fix

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

                    public function execute()
                    {
                        $fileKey = $this->getRequest()->getParam('log_key', '');
                        $output = '';
                
                
                Severity: Minor
                Found in Controller/Log/Reset.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 getTreeBlocksHierarchy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getTreeBlocksHierarchy($layout)
                    {
                        //$layout = $this->getLayout();
                
                        $reflection = new \ReflectionClass($layout);
                Severity: Minor
                Found in Observer/LayoutGenerateBlocksAfterObserver.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 __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        \Magento\Framework\App\Helper\Context $context,
                        \Magento\Framework\App\Cache\Frontend\Pool $cacheFrontendPool,
                        \Magento\Framework\Module\ModuleListInterface $moduleList,
                        \Magento\Framework\Filesystem $filesystem,
                        array $ideList,
                Severity: Major
                Found in Helper/Data.php - About 50 mins to fix

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

                          \Magento\Framework\App\Action\Context $context,
                          \ADM\QuickDevBar\Helper\Data $qdbHelper,
                          \Magento\Framework\Controller\Result\RawFactory $resultRawFactory,
                          \Magento\Framework\View\LayoutFactory $layoutFactory,
                          \Magento\Config\Model\ResourceModel\Config $resourceConfig,
                  Severity: Major
                  Found in Controller/Action/ConfigUpdate.php - About 50 mins to fix

                    The property $_config_values is not named in camelCase.
                    Open

                    class Config extends \ADM\QuickDevBar\Block\Tab\Panel
                    {
                        protected $_config_values;
                    
                        protected $_appConfig;
                    Severity: Minor
                    Found in Block/Tab/Content/Config.php by phpmd

                    CamelCasePropertyName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name attributes.

                    Example

                    class ClassName {
                        protected $property_name;
                    }

                    Source

                    The property $_appConfig is not named in camelCase.
                    Open

                    class Config extends \ADM\QuickDevBar\Block\Tab\Panel
                    {
                        protected $_config_values;
                    
                        protected $_appConfig;
                    Severity: Minor
                    Found in Block/Tab/Content/Config.php by phpmd

                    CamelCasePropertyName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name attributes.

                    Example

                    class ClassName {
                        protected $property_name;
                    }

                    Source

                    The property $_mergeService is not named in camelCase.
                    Open

                    class CacheCss extends \ADM\QuickDevBar\Controller\Index
                    {
                    
                    
                        protected $_mergeService;
                    Severity: Minor
                    Found in Controller/Action/CacheCss.php by phpmd

                    CamelCasePropertyName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name attributes.

                    Example

                    class ClassName {
                        protected $property_name;
                    }

                    Source

                    The property $_resultForwardFactory is not named in camelCase.
                    Open

                    class ConfigUpdate extends \ADM\QuickDevBar\Controller\Index
                    {
                        /**
                         * @var \Magento\Config\Model\Resource\Config
                         */
                    Severity: Minor
                    Found in Controller/Action/ConfigUpdate.php by phpmd

                    CamelCasePropertyName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name attributes.

                    Example

                    class ClassName {
                        protected $property_name;
                    }

                    Source

                    The property $_hasLoaded is not named in camelCase.
                    Open

                    class Translate extends \Magento\Framework\Translate
                    {
                        /**
                         * Checks if we have loaded our translation data.
                         *
                    Severity: Minor
                    Found in Helper/Translate.php by phpmd

                    CamelCasePropertyName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name attributes.

                    Example

                    class ClassName {
                        protected $property_name;
                    }

                    Source

                    The property $_layoutFactory is not named in camelCase.
                    Open

                    abstract class Index extends \Magento\Backend\App\Action
                    {
                    
                        /**
                         * @var \Magento\Framework\View\LayoutFactory
                    Severity: Minor
                    Found in Controller/Adminhtml/Index.php by phpmd

                    CamelCasePropertyName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name attributes.

                    Example

                    class ClassName {
                        protected $property_name;
                    }

                    Source

                    The property $_filePath is not named in camelCase.
                    Open

                    class Debug extends \Magento\Framework\App\Helper\AbstractHelper
                    {
                        private static $_filePath;
                    
                    
                    
                    Severity: Minor
                    Found in Helper/Debug.php by phpmd

                    CamelCasePropertyName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name attributes.

                    Example

                    class ClassName {
                        protected $property_name;
                    }

                    Source

                    Avoid variables with short names like $bt. Configured minimum length is 3.
                    Open

                        public function addDump(string $output, array $bt, $ajaxReq = null)
                    Severity: Minor
                    Found in Service/Dumper.php by phpmd

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Severity
                    Category
                    Status
                    Source
                    Language