pagseguro/magento2

View on GitHub

Showing 385 of 385 total issues

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

  _api_register('columns()', function (selector, opts) {
    // argument shifting
    if (selector === undefined) {
      selector = '';
    } else if ($.isPlainObject(selector)) {
Severity: Major
Found in view/adminhtml/web/js/jquery.dataTables.min.js and 1 other location - About 5 hrs to fix
view/adminhtml/web/js/jquery.dataTables.min.js on lines 7582..7606

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

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

    protected function getTransactions($page = null)
    {
        //check if has a page, if doesn't have one then start at the first.
        if ($page===null) $page = 1;

Severity: Major
Found in Model/Transactions/Method.php and 1 other location - About 5 hrs to fix
Model/Transactions/Methods/Abandoned.php on lines 271..301

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

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

    private function getPagSeguroAbandoned($page = null)
    {
        //check if has a page, if doesn't have one then start at the first.
        if ($page===null) $page = 1;

Severity: Major
Found in Model/Transactions/Methods/Abandoned.php and 1 other location - About 5 hrs to fix
Model/Transactions/Method.php on lines 50..80

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

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

    public function execute()
    {
        $lastRealOrder = $this->_checkoutSession->getLastRealOrder();

        if ($lastRealOrder->getPayment()===null) {
Severity: Minor
Found in Controller/Payment/Request.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

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

<?php
/**
 * 2007-2016 [PagSeguro Internet Ltda.]
 *
 * NOTICE OF LICENSE
Severity: Minor
Found in Helper/Data.php - About 4 hrs to fix

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

        function b(b) {
            return this.each(function() {
                var d = a(this),
                    e = d.data('bs.popover'),
                    f = 'object' === typeof b && b;
    Severity: Major
    Found in view/frontend/web/js/bootstrap.min.js and 1 other location - About 4 hrs to fix
    view/frontend/web/js/bootstrap.min.js on lines 898..907

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

    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

        function b(b) {
            return this.each(function() {
                var d = a(this),
                    e = d.data('bs.tooltip'),
                    f = 'object' === typeof b && b;
    Severity: Major
    Found in view/frontend/web/js/bootstrap.min.js and 1 other location - About 4 hrs to fix
    view/frontend/web/js/bootstrap.min.js on lines 1322..1331

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

    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

    CreditCardMethod has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CreditCardMethod
    {
        /**
         * @var \Magento\Checkout\Model\Session
         */
    Severity: Minor
    Found in Model/Direct/CreditCardMethod.php - About 4 hrs to fix

      File Method.php has 354 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * 2007-2016 [PagSeguro Internet Ltda.]
       *
       * NOTICE OF LICENSE
      Severity: Minor
      Found in Model/Transactions/Method.php - About 4 hrs to fix

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

        if (navigator.userAgent.search('Firefox') >= 0) {
          function MascaraData(data, event) {
            if (mascaraInteiro(data) === false) {
              event.return = false;
            }
        Severity: Major
        Found in view/frontend/web/js/model/direct-payment-validator.js and 1 other location - About 4 hrs to fix
        view/frontend/web/js/model/direct-payment-validator.js on lines 323..337

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

        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 (navigator.userAgent.search('Firefox') >= 0) {
          function creditCardMask(cc, event) {
            if (mascaraInteiro(cc) === false) {
              event.return = false;
            }
        Severity: Major
        Found in view/frontend/web/js/model/direct-payment-validator.js and 1 other location - About 4 hrs to fix
        view/frontend/web/js/model/direct-payment-validator.js on lines 289..303

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

        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 has 33 functions (exceeds 20 allowed). Consider refactoring.
        Open

        abstract class Method
        {
        
            /**
             * Sanitize configuration
        Severity: Minor
        Found in Model/Transactions/Method.php - About 4 hrs to fix

          Function getTitleCodePaymentMethod has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getTitleCodePaymentMethod($code)
              {
                  if (!is_null($code)) {
                      switch ($code) {
                          case 101:
          Severity: Minor
          Found in Helper/Data.php - About 4 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 _fnDraw has 101 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function _fnDraw(oSettings) {
              /* Provide a pre-callback function which can be used to cancel the draw is false is returned */
              var aPreDraw = _fnCallbackFire(oSettings, 'aoPreDrawCallback', 'preDraw', [
                oSettings,
              ]);
          Severity: Major
          Found in view/adminhtml/web/js/jquery.dataTables.min.js - About 4 hrs to fix

            Function _fnFeatureHtmlTable has 98 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function _fnFeatureHtmlTable(settings) {
                var table = $(settings.nTable);
            
                // Add the ARIA grid role to the table
                table.attr('role', 'grid');
            Severity: Major
            Found in view/adminhtml/web/js/jquery.dataTables.min.js - About 3 hrs to fix

              File jquery.mask.min.js has 328 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // jQuery Mask Plugin v1.14.0
              // github.com/igorescobar/jQuery-Mask-Plugin
              (function (b) {
                'function' === typeof define && define.amd
                  ? define(['jquery'], b)
              Severity: Minor
              Found in view/frontend/web/js/jquery.mask.min.js - About 3 hrs to fix

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

                                clearTimeout(c.timeout),
                                (c.hoverState = 'out'),
                                c.options.delay && c.options.delay.hide ?
                                void(c.timeout = setTimeout(function() {
                                    'out' === c.hoverState && c.hide();
                Severity: Major
                Found in view/frontend/web/js/bootstrap.min.js and 1 other location - About 3 hrs to fix
                view/frontend/web/js/bootstrap.min.js on lines 1023..1029

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

                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

                            (clearTimeout(c.timeout),
                                (c.hoverState = 'in'),
                                c.options.delay && c.options.delay.show ?
                                void(c.timeout = setTimeout(function() {
                                    'in' === c.hoverState && c.show();
                Severity: Major
                Found in view/frontend/web/js/bootstrap.min.js and 1 other location - About 3 hrs to fix
                view/frontend/web/js/bootstrap.min.js on lines 1053..1060

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

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

                <?php
                /**
                 * 2007-2016 [PagSeguro Internet Ltda.]
                 *
                 * NOTICE OF LICENSE
                Severity: Major
                Found in Controller/Adminhtml/Refund/Index.php and 3 other locations - About 3 hrs to fix
                Controller/Adminhtml/Cancellation/Index.php on lines 1..73
                Controller/Adminhtml/Conciliation/Index.php on lines 1..74
                Controller/Adminhtml/Transactions/Index.php on lines 1..73

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

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

                <?php
                /**
                 * 2007-2016 [PagSeguro Internet Ltda.]
                 *
                 * NOTICE OF LICENSE
                Severity: Major
                Found in Controller/Adminhtml/Cancellation/Index.php and 3 other locations - About 3 hrs to fix
                Controller/Adminhtml/Conciliation/Index.php on lines 1..74
                Controller/Adminhtml/Refund/Index.php on lines 1..74
                Controller/Adminhtml/Transactions/Index.php on lines 1..73

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

                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

                Severity
                Category
                Status
                Source
                Language