mygento/yandexdelivery

View on GitHub

Showing 22 of 262 total issues

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

    private function sign($data, $method)
    {
        $data['client_id'] = $this->getConfigData('client_id');

        $secretKey = '';
Severity: Minor
Found in app/code/local/Mygento/Yandexdelivery/Helper/Data.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

File Carrier.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 *
 *
Severity: Minor
Found in app/code/local/Mygento/Yandexdelivery/Model/Carrier.php - About 2 hrs to fix

    Method getOrderData has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function getOrderData($order) {
    
            if (Mage::getStoreConfig('carriers/' . $this->_name . '/onlyone')) {
                $weight = round(Mage::getStoreConfig('carriers/' . $this->_name . '/oneweight') * 1000 / Mage::getStoreConfig('carriers/' . $this->_name . '/weightunit'), 3);
                $dimensions = Mage::helper($this->_name)->getStandardSizes();
    Severity: Major
    Found in app/code/local/Mygento/Yandexdelivery/Model/Carrier.php - About 2 hrs to fix

      Method collectRates has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function collectRates(Mage_Shipping_Model_Rate_Request $request)
          {
              Varien_Profiler::start($this->_name . '_collect_rate');
      
              if (!$this->getType()) {
      Severity: Major
      Found in app/code/local/Mygento/Yandexdelivery/Model/Shipping.php - About 2 hrs to fix

        Function autocomp has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function autocomp(name)
            {
                jQuery('input[name="' + name + '[city]"]').autocomplete({
                    source: function (request, response) {
                        jQuery.ajax({
        Severity: Major
        Found in skin/frontend/base/default/_js/yandexdelivery.js - About 2 hrs to fix

          Mygento_Yandexdelivery_Model_Carrier has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Mygento_Yandexdelivery_Model_Carrier {
          
              private $_name = 'yandexdelivery';
              private $_url = 'https://delivery.yandex.ru/api/last/';
          
          
          Severity: Minor
          Found in app/code/local/Mygento/Yandexdelivery/Model/Carrier.php - About 2 hrs to fix

            Method sendAction has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function sendAction()
                {
            
                    if (!$this->getRequest()->isPost()) {
                        Mage::getSingleton('adminhtml/session')->addError('Sending error');

              Method getAjaxButton has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getAjaxButton($name, $title, $url)
                  {
                      $html = $this->getLayout()->createBlock('adminhtml/widget_button')
                                      ->setData([
                                          'label' => Mage::helper('yandexdelivery')->__($title),

                Method processType has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function processType($response, $type, $request, $result)
                    {
                
                        foreach ($response->data as $carrier_offer) {
                            $price = $request->getFreeShipping() ? 0 : $carrier_offer->cost;
                Severity: Minor
                Found in app/code/local/Mygento/Yandexdelivery/Model/Shipping.php - About 1 hr to fix

                  Function getSizes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getSizes($items, $is_quote)
                      {
                          $temporary_dimensions = [];
                          $weight = 0;
                  
                  
                  Severity: Minor
                  Found in app/code/local/Mygento/Yandexdelivery/Helper/Data.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 getTable has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getTable()
                      {
                          //таблица с статусами заказа
                  
                          if (!$this->hasYdId()) {

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

                        public function processApiIds($data_string) {
                    
                            $json = json_decode(trim($data_string));
                            $res = Mage::getSingleton('core/resource');
                    
                    
                    Severity: Minor
                    Found in app/code/local/Mygento/Yandexdelivery/Model/Carrier.php - About 1 hr to fix

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

                          private function sign($data, $method)
                          {
                              $data['client_id'] = $this->getConfigData('client_id');
                      
                              $secretKey = '';
                      Severity: Minor
                      Found in app/code/local/Mygento/Yandexdelivery/Helper/Data.php - About 1 hr to fix

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

                            protected function getOrderData($order) {
                        
                                if (Mage::getStoreConfig('carriers/' . $this->_name . '/onlyone')) {
                                    $weight = round(Mage::getStoreConfig('carriers/' . $this->_name . '/oneweight') * 1000 / Mage::getStoreConfig('carriers/' . $this->_name . '/weightunit'), 3);
                                    $dimensions = Mage::helper($this->_name)->getStandardSizes();
                        Severity: Minor
                        Found in app/code/local/Mygento/Yandexdelivery/Model/Carrier.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 confirmOrder has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function confirmOrder($ydId, $senderId, $type, $showAdmin = true)
                            {
                        
                                $result = Mage::getModel('yandexdelivery/carrier')->confirmOrders($ydId, $senderId, $type);
                        
                        

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

                            public function getSizes($items, $is_quote)
                            {
                                $temporary_dimensions = [];
                                $weight = 0;
                        
                        
                        Severity: Minor
                        Found in app/code/local/Mygento/Yandexdelivery/Helper/Data.php - About 1 hr to fix

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

                              public function createOrder($orderId, $warehouseId, $senderId, $requisiteId, $date, $street, $house) {
                          Severity: Major
                          Found in app/code/local/Mygento/Yandexdelivery/Model/Carrier.php - About 50 mins to fix

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

                                private function processType($response, $type, $request, $result)
                                {
                            
                                    foreach ($response->data as $carrier_offer) {
                                        $price = $request->getFreeShipping() ? 0 : $carrier_offer->cost;
                            Severity: Minor
                            Found in app/code/local/Mygento/Yandexdelivery/Model/Shipping.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 collectRates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function collectRates(Mage_Shipping_Model_Rate_Request $request)
                                {
                                    Varien_Profiler::start($this->_name . '_collect_rate');
                            
                                    if (!$this->getType()) {
                            Severity: Minor
                            Found in app/code/local/Mygento/Yandexdelivery/Model/Shipping.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

                            Function isValidDimensionArr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private function isValidDimensionArr($arr)
                                {
                                    if (is_array($arr) and 3 == sizeof($arr)) {
                                        foreach ($arr as $a) {
                                            if ((!is_int($a) and ! is_float($a)) or $a < 0.1) {
                            Severity: Minor
                            Found in app/code/local/Mygento/Yandexdelivery/Helper/Data.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

                            Severity
                            Category
                            Status
                            Source
                            Language