mundipagg/magento2

View on GitHub

Showing 453 of 453 total issues

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

    public function updateConfigProductPlanIntervalPeriod($setup)
    {

        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
        $eavSetup->addAttribute(
Severity: Major
Found in Setup/Recurrence.php and 17 other locations - About 5 hrs to fix
Setup/Recurrence.php on lines 186..218
Setup/Recurrence.php on lines 220..252
Setup/Recurrence.php on lines 339..371
Setup/Recurrence.php on lines 409..441
Setup/Recurrence.php on lines 483..514
Setup/Recurrence.php on lines 555..586
Setup/Recurrence.php on lines 588..619
Setup/Recurrence.php on lines 621..652
Setup/UpgradeData.php on lines 279..309
Setup/UpgradeData.php on lines 346..376
Setup/UpgradeData.php on lines 378..408
Setup/UpgradeData.php on lines 490..520
Setup/UpgradeData.php on lines 557..587
Setup/UpgradeData.php on lines 625..655
Setup/UpgradeData.php on lines 666..696
Setup/UpgradeData.php on lines 698..728
Setup/UpgradeData.php on lines 730..760

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

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

    public function getConfig()
    {
        $config = [
            'payment' => [
                'ccform' => [
Severity: Major
Found in Model/Ui/Base/GenericInstallmentsConfigProvider.php - About 4 hrs to fix

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

    CreditCardValidator.prototype.isInputInvalid = function (element, message = "") {
    
        var parentsElements = element.parent().parent();
    
        if (element.val() == "") {
    Severity: Major
    Found in view/frontend/web/js/core/validators/CreditCardValidator.js and 2 other locations - About 4 hrs to fix
    view/frontend/web/js/core/validators/MultibuyerValidator.js on lines 42..54
    view/frontend/web/js/core/validators/VoucherCardValidator.js on lines 42..55

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

    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 3 locations. Consider refactoring.
    Open

    VoucherCardValidator.prototype.isInputInvalid = function (element, message = "") {
    
        var parentsElements = element.parent().parent();
    
        if (element.val() == "") {
    view/frontend/web/js/core/validators/CreditCardValidator.js on lines 88..101
    view/frontend/web/js/core/validators/MultibuyerValidator.js on lines 42..54

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

    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 3 locations. Consider refactoring.
    Open

    MultibuyerValidator.prototype.isInputInvalid = function (element, message = "") {
        var parentsElements = element.parent().parent();
    
        if (element.val() == "") {
            parentsElements.addClass("_error");
    Severity: Major
    Found in view/frontend/web/js/core/validators/MultibuyerValidator.js and 2 other locations - About 4 hrs to fix
    view/frontend/web/js/core/validators/CreditCardValidator.js on lines 88..101
    view/frontend/web/js/core/validators/VoucherCardValidator.js on lines 42..55

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

    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

    Function beforeInitializeLinks has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        public function beforeInitializeLinks(
            \Magento\Catalog\Model\Product\Initialization\Helper\ProductLinks $subject,
            \Magento\Catalog\Model\Product $product,
            array $links
        ) {

    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

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

        private function getCardsCore()
        {
            $cards = [];
    
            $customerRepository = new CustomerRepository();
    Severity: Major
    Found in Model/Ui/Debit/ConfigProvider.php and 1 other location - About 4 hrs to fix
    Model/Ui/Voucher/ConfigProvider.php on lines 42..70

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

    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

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

        private function getCardsCore()
        {
            $cards = [];
    
            $customerRepository = new CustomerRepository();
    Severity: Major
    Found in Model/Ui/Voucher/ConfigProvider.php and 1 other location - About 4 hrs to fix
    Model/Ui/Debit/ConfigProvider.php on lines 39..67

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

    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

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

            if (
                typeof this.formObject[id].savedCreditCardSelect.val() != 'undefined' &&
                this.formObject[id].savedCreditCardSelect.val() != 'new' &&
                this.formObject[id].savedCreditCardSelect.val() != '' &&
                this.formObject[id].savedCreditCardSelect.html().length > 1
    Severity: Major
    Found in view/frontend/web/js/core/models/BoletoCreditcardModel.js and 1 other location - About 4 hrs to fix
    view/frontend/web/js/core/models/TwoCreditcardsModel.js on lines 53..60

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

    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

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

            if (
                typeof this.formObject[id].savedCreditCardSelect.val() != 'undefined' &&
                this.formObject[id].savedCreditCardSelect.val() != 'new' &&
                this.formObject[id].savedCreditCardSelect.val() != '' &&
                this.formObject[id].savedCreditCardSelect.html().length > 1
    Severity: Major
    Found in view/frontend/web/js/core/models/TwoCreditcardsModel.js and 1 other location - About 4 hrs to fix
    view/frontend/web/js/core/models/BoletoCreditcardModel.js on lines 20..27

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

    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

    File UpgradeSchema.php has 339 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    namespace MundiPagg\MundiPagg\Setup;
    
    use Magento\Framework\Setup\UpgradeSchemaInterface;
    use Magento\Framework\Setup\ModuleContextInterface;
    Severity: Minor
    Found in Setup/UpgradeSchema.php - About 4 hrs to fix

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

          public function getConfig()
          {
              $selectedCard = '';
              $isSavedCard = 0;
              $cards = [];
      Severity: Major
      Found in Model/Ui/Voucher/ConfigProvider.php and 1 other location - About 4 hrs to fix
      Model/Ui/Debit/ConfigProvider.php on lines 69..99

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

      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

          public function getConfig()
          {
              $selectedCard = '';
              $isSavedCard = 0;
              $cards = [];
      Severity: Major
      Found in Model/Ui/Debit/ConfigProvider.php and 1 other location - About 4 hrs to fix
      Model/Ui/Voucher/ConfigProvider.php on lines 72..102

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

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

          public function installCharge(
              SchemaSetupInterface $installer
          ) {
              $tableName = $installer->getTable('mundipagg_module_core_charge');
              if (!$installer->getConnection()->isTableExists($tableName)) {
      Severity: Major
      Found in Setup/InstallSchema.php - About 3 hrs to fix

        Method updateVersionZeroOneTwo has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function updateVersionZeroOneTwo($setup)
            {
                $installer = $setup;
                $installer->startSetup();
         
        Severity: Major
        Found in Setup/UpgradeData.php - About 3 hrs to fix

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

              protected function setNewCardAdditionalData($info, $additionalData)
              {
                  $info->setAdditionalInformation('cc_saved_card', $additionalData->getCcSavedCard());
                  $info->setAdditionalInformation('cc_type', $additionalData->getCcType());
                  $info->setAdditionalInformation('cc_last_4', substr($additionalData->getCcLast4(),-4));
          Severity: Major
          Found in Observer/VoucherDataAssignObserver.php and 1 other location - About 3 hrs to fix
          Observer/DebitDataAssignObserver.php on lines 60..76

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

          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

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

              protected function setNewCardAdditionalData($info, $additionalData)
              {
                  $info->setAdditionalInformation('cc_saved_card', $additionalData->getCcSavedCard());
                  $info->setAdditionalInformation('cc_type', $additionalData->getCcType());
                  $info->setAdditionalInformation('cc_last_4', substr($additionalData->getCcLast4(),-4));
          Severity: Major
          Found in Observer/DebitDataAssignObserver.php and 1 other location - About 3 hrs to fix
          Observer/VoucherDataAssignObserver.php on lines 60..76

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

          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

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

          <?php
          /**
           * Class GeneralHandler
           *
           * @author      MundiPagg Embeddables Team <embeddables@mundipagg.com>
          Gateway/Transaction/CreditCard/ResourceGateway/Refund/Response/GeneralHandler.php on lines 1..53

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

          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

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

          <?php
          /**
           * Class GeneralHandler
           *
           * @author      MundiPagg Embeddables Team <embeddables@mundipagg.com>
          Gateway/Transaction/CreditCard/ResourceGateway/Capture/Response/GeneralHandler.php on lines 1..53

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

          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

          Magento2CoreSetup has 30 functions (exceeds 20 allowed). Consider refactoring.
          Open

          final class Magento2CoreSetup extends AbstractModuleCoreSetup
          {
              const MODULE_NAME = 'MundiPagg_MundiPagg';
          
              protected function setModuleVersion()
          Severity: Minor
          Found in Concrete/Magento2CoreSetup.php - About 3 hrs to fix
            Severity
            Category
            Status
            Source
            Language