pagseguro/magento2

View on GitHub

Showing 385 of 385 total issues

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

        jQuery
          .ajax({
            url: url + '/pagseguro/conciliation/request',
            data: {
              form_key: window.FORM_KEY,
Severity: Major
Found in view/adminhtml/web/js/public.js and 3 other locations - About 1 hr to fix
view/adminhtml/web/js/public.js on lines 141..195
view/adminhtml/web/js/public.js on lines 255..306
view/adminhtml/web/js/public.js on lines 347..409

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

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

      var setData = function (data, val, src) {
        var a = _fnSplitObjNotation(src),
          b;
        var aLast = a[a.length - 1];
        var arrayNotation, funcNotation, o, innerSrc;
Severity: Minor
Found in view/adminhtml/web/js/jquery.dataTables.min.js - About 1 hr to fix

    Function fetchData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          var fetchData = function (data, type, src) {
            var arrayNotation, funcNotation, out, innerSrc;
    
            if (src !== '') {
              var a = _fnSplitObjNotation(src);
    Severity: Minor
    Found in view/adminhtml/web/js/jquery.dataTables.min.js - About 1 hr to fix

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

          for (i = size; i >= 1; i--) {
            sum += numbersVal.charAt(size - i) * pos--;
            if (pos < 2) {
              pos = 9;
            }
      Severity: Major
      Found in view/frontend/web/js/model/direct-payment-validator.js and 1 other location - About 1 hr to fix
      view/frontend/web/js/model/direct-payment-validator.js on lines 213..218

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

      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

          for (i = size; i >= 1; i--) {
            sum += numbersVal.charAt(size - i) * pos--;
            if (pos < 2) {
              pos = 9;
            }
      Severity: Major
      Found in view/frontend/web/js/model/direct-payment-validator.js and 1 other location - About 1 hr to fix
      view/frontend/web/js/model/direct-payment-validator.js on lines 198..203

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

      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

                jQuery
                  .ajax({
                    url: url + 'pagseguro/direct/boleto',
                    data: {
                      form_key: window.FORM_KEY,
      Severity: Major
      Found in view/frontend/web/js/public.js and 1 other location - About 1 hr to fix
      view/frontend/web/js/public.js on lines 70..124

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

      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

                jQuery
                  .ajax({
                    url: url + 'pagseguro/direct/installments',
                    data: {
                      form_key: window.FORM_KEY,
      Severity: Major
      Found in view/frontend/web/js/public.js and 1 other location - About 1 hr to fix
      view/frontend/web/js/public.js on lines 31..45

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

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

          finishOrder: function (self, paymentData, messageContainer, pagseguroHash) {
            $.when(
              setPaymentInformationAction(messageContainer, {
                method: self.getCode(),
                additional_data: {

        Method setShippingInformation has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function setShippingInformation()
            {
                if ($this->_checkoutSession->getLastRealOrder()->getIsVirtual()) {
                    $this->_paymentRequest->setShipping()->setAddressRequired()->withParameters('false');
                } else {
        Severity: Minor
        Found in Model/PaymentMethod.php - About 1 hr to fix

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

              protected function requestPagSeguroPayments($page)
              {
          
                  $date = $this->getDates();
          
          
          Severity: Major
          Found in Model/Transactions/Method.php and 1 other location - About 1 hr to fix
          Model/Transactions/Methods/Abandoned.php on lines 353..379

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

          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 requestPagSeguroAbandoned($page)
              {
          
                  $date = $this->getDates();
          
          
          Severity: Major
          Found in Model/Transactions/Methods/Abandoned.php and 1 other location - About 1 hr to fix
          Model/Transactions/Method.php on lines 185..211

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

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

              public static function getPaymentStatusToString($key)
              {
          
                  if (array_key_exists($key, self::$statusList)) {
                      switch ($key) {
          Severity: Minor
          Found in Helper/Data.php - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function _fnPageChange has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function _fnPageChange(settings, action, redraw) {
              var start = settings._iDisplayStart,
                len = settings._iDisplayLength,
                records = settings.fnRecordsDisplay();
          
          
          Severity: Minor
          Found in view/adminhtml/web/js/jquery.dataTables.min.js - About 1 hr to fix

            Function _fnApplyColumnDefs has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function _fnApplyColumnDefs(oSettings, aoColDefs, aoCols, fn) {
                var i, iLen, j, jLen, k, kLen, def;
                var columns = oSettings.aoColumns;
            
                // Column definitions with aTargets
            Severity: Minor
            Found in view/adminhtml/web/js/jquery.dataTables.min.js - About 1 hr to fix

              Function _selector_run has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                var _selector_run = function (type, selector, selectFn, settings, opts) {
                  var out = [],
                    res,
                    a,
                    i,
              Severity: Minor
              Found in view/adminhtml/web/js/jquery.dataTables.min.js - About 1 hr to fix

                Function _fnFeatureHtmlLength has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function _fnFeatureHtmlLength(settings) {
                    var classes = settings.oClasses,
                      tableId = settings.sTableId,
                      menu = settings.aLengthMenu,
                      d2 = $.isArray(menu[0]),
                Severity: Minor
                Found in view/adminhtml/web/js/jquery.dataTables.min.js - About 1 hr to fix

                  Method getPaymentStatusToString has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function getPaymentStatusToString($key)
                      {
                  
                          if (array_key_exists($key, self::$statusList)) {
                              switch ($key) {
                  Severity: Minor
                  Found in Helper/Data.php - About 1 hr to fix

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

                    var Modal = {
                      Load: function (title, content) {
                        require(['Magento_Ui/js/modal/alert'], function (alert) {
                          alert({
                            title: title,
                    Severity: Major
                    Found in view/frontend/web/js/public.js and 1 other location - About 1 hr to fix
                    view/adminhtml/web/js/public.js on lines 6..16

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

                    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

                    var Modal = {
                      Load: function (title, content) {
                        require(['Magento_Ui/js/modal/alert'], function (alert) {
                          alert({
                            title: title,
                    Severity: Major
                    Found in view/adminhtml/web/js/public.js and 1 other location - About 1 hr to fix
                    view/frontend/web/js/public.js on lines 6..16

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

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

                      function _fnColumnTypes(settings) {
                        var columns = settings.aoColumns;
                        var data = settings.aoData;
                        var types = DataTable.ext.type.detect;
                        var i, ien, j, jen, k, ken;
                    Severity: Minor
                    Found in view/adminhtml/web/js/jquery.dataTables.min.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language