mundipagg/magento2

View on GitHub

Showing 453 of 453 total issues

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

    if (paymentMethod.methodCode === "boletoCreditcard") {
        var boletoCreditCardTotalObject = paymentMethod.boletoCreditCardTotal(paymentMethod);

        grandTotal = boletoCreditCardTotalObject.sumTotal;
        interest = boletoCreditCardTotalObject.sumInterestTotal;
Severity: Minor
Found in view/frontend/web/js/core/checkout/PaymentMethodController.js and 1 other location - About 50 mins to fix
view/frontend/web/js/core/checkout/PaymentMethodController.js on lines 440..445

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

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

    if (paymentMethod.methodCode === "twocreditcards") {
        var twoCardsTotalObject = paymentMethod.twoCardsTotal(paymentMethod);

        grandTotal = twoCardsTotalObject.sumTotal;
        interest = twoCardsTotalObject.sumInterestTotal;
Severity: Minor
Found in view/frontend/web/js/core/checkout/PaymentMethodController.js and 1 other location - About 50 mins to fix
view/frontend/web/js/core/checkout/PaymentMethodController.js on lines 447..452

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

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

            {
                title: 'UnionPay',
                type: 'UN',
                pattern: '^(622(1(2[6-9]|[3-9])|[3-8]|9([[0-1]|2[0-5]))|62[4-6]|628([2-8]))\\d*?$',
                gaps: [4, 8, 12],
view/frontend/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js on lines 60..70
view/frontend/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js on lines 71..81

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

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

    public function getCustomerAddressComplement($shipping)
    {
        if ($shipping) {
            $response = !$this->getShippingAddressAttribute($this->getConfig()->getCustomerAddressDistrict()) ? '' : $this->getShippingAddressAttribute($this->getConfig()->getCustomerAddressComplement());
        }else{
Gateway/Transaction/BilletCreditCard/ResourceGateway/Create/RequestDataProvider.php on lines 235..244
Gateway/Transaction/CreditCard/ResourceGateway/Create/RequestDataProvider.php on lines 226..235
Gateway/Transaction/TwoCreditCard/ResourceGateway/Create/RequestDataProvider.php on lines 234..243

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

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

    public function getCustomerAddressComplement($shipping)
    {
        if ($shipping) {
            $response = !$this->getShippingAddressAttribute($this->getConfig()->getCustomerAddressDistrict()) ? '' : $this->getShippingAddressAttribute($this->getConfig()->getCustomerAddressComplement());
        }else{
Gateway/Transaction/Billet/ResourceGateway/Create/RequestDataProvider.php on lines 110..119
Gateway/Transaction/BilletCreditCard/ResourceGateway/Create/RequestDataProvider.php on lines 235..244
Gateway/Transaction/TwoCreditCard/ResourceGateway/Create/RequestDataProvider.php on lines 234..243

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

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

    public function getCustomerAddressComplement($shipping)
    {
        if ($shipping) {
            $response = !$this->getShippingAddressAttribute($this->getConfig()->getCustomerAddressDistrict()) ? '' : $this->getShippingAddressAttribute($this->getConfig()->getCustomerAddressComplement());
        }else{
Gateway/Transaction/Billet/ResourceGateway/Create/RequestDataProvider.php on lines 110..119
Gateway/Transaction/BilletCreditCard/ResourceGateway/Create/RequestDataProvider.php on lines 235..244
Gateway/Transaction/CreditCard/ResourceGateway/Create/RequestDataProvider.php on lines 226..235

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

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

    public function getCustomerAddressComplement($shipping)
    {
        if ($shipping) {
            $response = !$this->getShippingAddressAttribute($this->getConfig()->getCustomerAddressDistrict()) ? '' : $this->getShippingAddressAttribute($this->getConfig()->getCustomerAddressComplement());
        }else{
Gateway/Transaction/Billet/ResourceGateway/Create/RequestDataProvider.php on lines 110..119
Gateway/Transaction/CreditCard/ResourceGateway/Create/RequestDataProvider.php on lines 226..235
Gateway/Transaction/TwoCreditCard/ResourceGateway/Create/RequestDataProvider.php on lines 234..243

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

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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        RecurrenceProductHelper $recurrenceProductHelper,
        TimezoneInterface $timeZone,
        StoreManagerInterface $storeManager,
        Session $customerSession,
        Rule $catalogRule,
Severity: Minor
Found in Observer/CartAddProductAfterObserver.php - About 45 mins to fix

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

        private function extractBasePaymentData($additionalInformation)
        {
            $moneyService = new MoneyService();
            $identifier = null;
            $customerId = null;
    Severity: Minor
    Found in Concrete/Magento2PlatformOrderDecorator.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 getBilletUrl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getBilletUrl()
        {
            $method = $this->getInfo()->getMethod();
    
            if (strpos($method, "mundipagg_billet") === false) {
    Severity: Minor
    Found in Block/Payment/Info/BilletCreditCard.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 fillSavedCreditCardsSelect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    FormHandler.prototype.fillSavedCreditCardsSelect = function (platformConfig, formObject) {
        var html = '';
        var cards = platformConfig.savedAllCards[formObject.savedCardSelectUsed]
    
        var brands = [];
    Severity: Minor
    Found in view/frontend/web/js/core/checkout/PlatformFormHandler.js - 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 updateAcquirerData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function updateAcquirerData(Order $order)
        {
            $platformOrder = $order->getPlatformOrder()->getPlatformOrder();
    
            $objectManager = ObjectManager::getInstance();
    Severity: Minor
    Found in Concrete/Magento2DataService.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 addressValidation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addressValidation($customerAddress)
        {
            $allStreetLines = $customerAddress->getStreet();
    
            if (empty($customerAddress->getCity())) {
    Severity: Minor
    Found in Observer/CustomerAddressSaveBefore.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 getInstallmentsByRecurrence has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getInstallmentsByRecurrence($quote, $installments)
        {
            $items = $quote->getItems();
    
            if (!$items) {
    Severity: Minor
    Found in Model/InstallmentsByBrandAndAmountManagement.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

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

            ContextInterface $context,
            UiComponentFactory $uiComponentFactory,
            UrlBuilder $actionUrlBuilder,
            UrlInterface $urlBuilder,
            array $components = [],
    Severity: Minor
    Found in Ui/Component/Column/Invoices/Actions.php - About 45 mins to fix

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

          public function getById($cardsId)
          {
              $cards = $this->cardsFactory->create();
              $cards->getResource()->load($cards, $cardsId);
              if (!$cards->getId()) {
      Severity: Minor
      Found in Model/CardsRepository.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

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

              ContextInterface $context,
              UiComponentFactory $uiComponentFactory,
              UrlBuilder $actionUrlBuilder,
              UrlInterface $urlBuilder,
              array $components = [],
      Severity: Minor
      Found in Ui/Component/Column/Actions.php - About 45 mins to fix

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

            public function getConfig()
            {
                $selectedCard = '';
                $cards = [];
        
        
        Severity: Minor
        Found in Model/Ui/TwoCreditCard/ConfigProvider.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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function execute()
            {
                if (!$this->customerSession->isLoggedIn()) {
                    $this->_redirect('customer/account/login'); 
        
        
        Severity: Minor
        Found in Controller/Customer/Remove.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

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

                ContextInterface $context,
                UiComponentFactory $uiComponentFactory,
                UrlBuilder $actionUrlBuilder,
                UrlInterface $urlBuilder,
                array $components = [],
        Severity: Minor
        Found in Ui/Component/Column/Subscriptions/Actions.php - About 45 mins to fix
          Severity
          Category
          Status
          Source
          Language