vpietri/magento2-developer-quickdevbar

View on GitHub

Showing 45 of 169 total issues

Function pullData has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public function pullData()
    {
        if ($this->pluginsByTypes === null) {
            $this->pluginsByTypes =  [];

Severity: Minor
Found in Service/Plugin.php - About 5 hrs 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 execute has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute()
    {

        $error = false;
        $output = '';
Severity: Minor
Found in Controller/Action/ConfigUpdate.php - About 3 hrs 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

Data has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

class Data extends \Magento\Framework\App\Helper\AbstractHelper
{


    /**
Severity: Minor
Found in Helper/Data.php - About 3 hrs to fix

    Function initSqlProfilerData has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function initSqlProfilerData()
        {
            $longestQueryTime = 0;
            $shortestQueryTime = 100000;
            $longestQuery = '';
    Severity: Minor
    Found in Service/Sql.php - About 3 hrs 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 execute has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function execute()
        {
    
            $error = false;
            $output = '';
    Severity: Major
    Found in Controller/Action/ConfigUpdate.php - About 3 hrs to fix

      File Data.php has 264 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      namespace ADM\QuickDevBar\Helper;
      
      use Magento\Customer\Model\Session;
      use Magento\Framework\App\Config\ScopeConfigInterface;
      Severity: Minor
      Found in Helper/Data.php - About 2 hrs to fix

        Method initSqlProfilerData has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function initSqlProfilerData()
            {
                $longestQueryTime = 0;
                $shortestQueryTime = 100000;
                $longestQuery = '';
        Severity: Major
        Found in Service/Sql.php - About 2 hrs to fix

          Function getHtmlBlocksHierarchy has a Cognitive Complexity of 16 (exceeds 5 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 2 hrs 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 buildTreeBlocks has a Cognitive Complexity of 15 (exceeds 5 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

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

              public static function trace(array $trace=[], $skipLine = null)
              {
                  if(empty($trace)) {
                      $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
                      is_null($skipLine) && $skipLine=1;
          Severity: Minor
          Found in Helper/Debug.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 __construct has 14 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  DesignInterface $viewDesign,
                  FrontendInterface $cache,
                  ViewFileSystem $viewFileSystem,
                  ModuleList $moduleList,
                  Reader $modulesReader,
          Severity: Major
          Found in Helper/Translate.php - About 1 hr to fix

            Function load has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    load: function( index, event ) {
                        index = this._getIndex( index );
                        let that = this,
                            tab = this.tabs.eq( index ),
                            anchor = tab.find( ".ui-tabs-anchor" ),
            Severity: Minor
            Found in view/base/web/js/quickdevbar.js - About 1 hr to fix

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

                        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

                          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

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language