mygento/yandexdelivery

View on GitHub

Showing 262 of 262 total issues

The class Mygento_Yandexdelivery_Model_Carrier has an overall complexity of 57 which is very high. The configured complexity threshold is 50.
Open

class Mygento_Yandexdelivery_Model_Carrier {

    private $_name = 'yandexdelivery';
    private $_url = 'https://delivery.yandex.ru/api/last/';

The class Mygento_Yandexdelivery_Helper_Data has an overall complexity of 52 which is very high. The configured complexity threshold is 50.
Open

class Mygento_Yandexdelivery_Helper_Data extends Mage_Core_Helper_Abstract
{

    private $_name = 'yandexdelivery';

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      $warehouse_table = $installer->getConnection()
              ->newTable($installer->getTable('yandexdelivery/warehouse'))
              ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, [
                  'unsigned' => true,
                  'nullable' => false,
      app/code/local/Mygento/Yandexdelivery/sql/yandexdelivery_setup/install-1.0.0.php on lines 61..78

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 134.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      $requisite_table = $installer->getConnection()
              ->newTable($installer->getTable('yandexdelivery/requisite'))
              ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, [
                  'unsigned' => true,
                  'nullable' => false,
      app/code/local/Mygento/Yandexdelivery/sql/yandexdelivery_setup/install-1.0.0.php on lines 39..59

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 134.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

                  Avoid excessively long class names like Mygento_Yandexdelivery_Model_Source_Attribute. Keep class name length under 40.
                  Open

                  class Mygento_Yandexdelivery_Model_Source_Attribute
                  {
                  
                      public function getAllOptions()
                      {

                  LongClassName

                  Since: 2.9

                  Detects when classes or interfaces are declared with excessively long names.

                  Example

                  class ATooLongClassNameThatHintsAtADesignProblem {
                  
                  }
                  
                  interface ATooLongInterfaceNameThatHintsAtADesignProblem {
                  
                  }

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

                  Avoid excessively long class names like Mygento_Yandexdelivery_Block_Adminhtml_Shipment_Grid. Keep class name length under 40.
                  Open

                  class Mygento_Yandexdelivery_Block_Adminhtml_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid
                  {
                  
                      public function _construct()
                      {

                  LongClassName

                  Since: 2.9

                  Detects when classes or interfaces are declared with excessively long names.

                  Example

                  class ATooLongClassNameThatHintsAtADesignProblem {
                  
                  }
                  
                  interface ATooLongInterfaceNameThatHintsAtADesignProblem {
                  
                  }

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

                  Avoid excessively long class names like Mygento_Yandexdelivery_Model_Carrier_Post. Keep class name length under 40.
                  Open

                  class Mygento_Yandexdelivery_Model_Carrier_Post extends Mygento_Yandexdelivery_Model_Shipping
                  {
                  
                      protected $_subcode = 'post';
                  
                  

                  LongClassName

                  Since: 2.9

                  Detects when classes or interfaces are declared with excessively long names.

                  Example

                  class ATooLongClassNameThatHintsAtADesignProblem {
                  
                  }
                  
                  interface ATooLongInterfaceNameThatHintsAtADesignProblem {
                  
                  }

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

                  Avoid excessively long class names like Mygento_Yandexdelivery_Block_Adminhtml_Order_View_Tab. Keep class name length under 40.
                  Open

                  class Mygento_Yandexdelivery_Block_Adminhtml_Order_View_Tab extends Mage_Adminhtml_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface
                  {
                  
                      public function _construct()
                      {

                  LongClassName

                  Since: 2.9

                  Detects when classes or interfaces are declared with excessively long names.

                  Example

                  class ATooLongClassNameThatHintsAtADesignProblem {
                  
                  }
                  
                  interface ATooLongInterfaceNameThatHintsAtADesignProblem {
                  
                  }

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

                  Avoid excessively long class names like Mygento_Yandexdelivery_Model_Carrier_Pickup. Keep class name length under 40.
                  Open

                  class Mygento_Yandexdelivery_Model_Carrier_Pickup extends Mygento_Yandexdelivery_Model_Shipping
                  {
                  
                      protected $_subcode = 'pickup';
                  
                  

                  LongClassName

                  Since: 2.9

                  Detects when classes or interfaces are declared with excessively long names.

                  Example

                  class ATooLongClassNameThatHintsAtADesignProblem {
                  
                  }
                  
                  interface ATooLongInterfaceNameThatHintsAtADesignProblem {
                  
                  }

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

                  Avoid excessively long class names like Mygento_Yandexdelivery_Model_Resource_Shipment_Collection. Keep class name length under 40.
                  Open

                  class Mygento_Yandexdelivery_Model_Resource_Shipment_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
                  {
                  
                      public function _construct()
                      {

                  LongClassName

                  Since: 2.9

                  Detects when classes or interfaces are declared with excessively long names.

                  Example

                  class ATooLongClassNameThatHintsAtADesignProblem {
                  
                  }
                  
                  interface ATooLongInterfaceNameThatHintsAtADesignProblem {
                  
                  }

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

                  Avoid excessively long class names like Mygento_Yandexdelivery_Model_Resource_Requisite_Collection. Keep class name length under 40.
                  Open

                  class Mygento_Yandexdelivery_Model_Resource_Requisite_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
                  {
                  
                      public function _construct()
                      {

                  LongClassName

                  Since: 2.9

                  Detects when classes or interfaces are declared with excessively long names.

                  Example

                  class ATooLongClassNameThatHintsAtADesignProblem {
                  
                  }
                  
                  interface ATooLongInterfaceNameThatHintsAtADesignProblem {
                  
                  }

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

                  Severity
                  Category
                  Status
                  Source
                  Language