yurijmi/better_offsite_payments

View on GitHub

Showing 50 of 50 total issues

Class Notification has 38 methods (exceeds 20 allowed). Consider refactoring.
Open

      class Notification < OffsitePayments::Notification

        def unescape(val) #:nodoc:
          if val
            CGI::unescape val
Severity: Minor
Found in lib/offsite_payments/integrations/authorize_net_sim.rb - About 5 hrs to fix

    Class Notification has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class Notification < OffsitePayments::Notification
            self.production_ips = [
              '78.108.178.206',
              '79.137.235.129',
              '95.163.96.79',
    Severity: Minor
    Found in lib/offsite_payments/integrations/a1agregator.rb - About 3 hrs to fix

      Class Notification has 28 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class Notification < OffsitePayments::Notification
              def complete?
                status == 'Completed'
              end
      
      
      Severity: Minor
      Found in lib/offsite_payments/integrations/world_pay.rb - About 3 hrs to fix

        Class Notification has 28 methods (exceeds 20 allowed). Consider refactoring.
        Open

              class Notification < OffsitePayments::Notification
                def initialize(post, options = {})
                  super(post, options)
                  @merchant_id = options[:credential1]
                  @secret_key = options[:credential2]
        Severity: Minor
        Found in lib/offsite_payments/integrations/payu_in.rb - About 3 hrs to fix

          Class Notification has 27 methods (exceeds 20 allowed). Consider refactoring.
          Open

                class Notification < OffsitePayments::Notification
                  include Common
                  def initialize(post, options={})
                    super
                    @secret = options[:credential3]
          Severity: Minor
          Found in lib/offsite_payments/integrations/realex_offsite.rb - About 3 hrs to fix

            Class Notification has 27 methods (exceeds 20 allowed). Consider refactoring.
            Open

                  class Notification < OffsitePayments::Notification
                    include ActiveUtils::PostsData
                    include ActiveUtils::RequiresParameters
            
                    def initialize(query_string, options={})
            Severity: Minor
            Found in lib/offsite_payments/integrations/pxpay.rb - About 3 hrs to fix

              File sage_pay_form.rb has 292 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module OffsitePayments #:nodoc:
                module Integrations #:nodoc:
                  module SagePayForm
                    mattr_accessor :production_url
                    mattr_accessor :test_url
              Severity: Minor
              Found in lib/offsite_payments/integrations/sage_pay_form.rb - About 3 hrs to fix

                Class Notification has 26 methods (exceeds 20 allowed). Consider refactoring.
                Open

                      class Notification < OffsitePayments::Notification
                        def complete?
                          status == 'Completed'
                        end
                
                
                Severity: Minor
                Found in lib/offsite_payments/integrations/chronopay.rb - About 3 hrs to fix

                  Class Notification has 25 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                        class Notification < OffsitePayments::Notification
                          class CryptError < StandardError; end
                  
                          include Encryption
                  
                  
                  Severity: Minor
                  Found in lib/offsite_payments/integrations/sage_pay_form.rb - About 2 hrs to fix

                    Class Notification has 25 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                          class Notification < OffsitePayments::Notification
                            def initialize(post, options = {})
                              super(post, options)
                              @secret_key = options[:credential2]
                            end
                    Severity: Minor
                    Found in lib/offsite_payments/integrations/citrus.rb - About 2 hrs to fix

                      Method generate_md5string has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def generate_md5string
                                fields = [@fields["pmt_action"], @fields["pmt_version"]]
                                fields += [@fields["pmt_selleriban"]] unless @fields["pmt_selleriban"].nil?
                                fields += [@fields["pmt_id"], @fields["pmt_orderid"], @fields["pmt_reference"], @fields["pmt_duedate"],
                                @fields["pmt_amount"], @fields["pmt_currency"], @fields["pmt_okreturn"], @fields["pmt_errorreturn"], @fields["pmt_cancelreturn"],
                      Severity: Minor
                      Found in lib/offsite_payments/integrations/maksuturva.rb - About 2 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

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

                            class Notification < OffsitePayments::Notification
                              def initialize(post_arguments, options = {})
                                super
                      
                                raise ArgumentError, "The transaction_id needs to be included in the query string." if transaction_id.nil?
                      Severity: Major
                      Found in lib/offsite_payments/integrations/mollie_ideal.rb and 1 other location - About 2 hrs to fix
                      lib/offsite_payments/integrations/mollie_mistercash.rb on lines 79..134

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

                      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

                              class Notification < OffsitePayments::Notification
                                def initialize(post_arguments, options = {})
                                  super
                      
                                  raise ArgumentError, "The transaction_id needs to be included in the query string." if transaction_id.nil?
                      Severity: Major
                      Found in lib/offsite_payments/integrations/mollie_mistercash.rb and 1 other location - About 2 hrs to fix
                      lib/offsite_payments/integrations/mollie_ideal.rb on lines 131..186

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

                      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 authorize_net_sim.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      module OffsitePayments #:nodoc:
                        module Integrations #:nodoc:
                          module AuthorizeNetSim
                            # Overwrite this if you want to change the ANS test url
                            mattr_accessor :test_url
                      Severity: Minor
                      Found in lib/offsite_payments/integrations/authorize_net_sim.rb - About 2 hrs to fix

                        Class Notification has 23 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                              class Notification < OffsitePayments::Notification
                                def initialize(*args)
                                  super
                                  @signature = params.delete('pg_sig')
                                end
                        Severity: Minor
                        Found in lib/offsite_payments/integrations/platron.rb - About 2 hrs to fix

                          Method verify_response has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                                  def verify_response(params, secret)
                                    logstr = ''
                                    params.each { |key, value|
                                      logstr += "#{key} #{value}\n"
                                    }
                          Severity: Minor
                          Found in lib/offsite_payments/integrations/wirecard_checkout_page.rb - About 2 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 wirecard_checkout_page.rb has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          module OffsitePayments #:nodoc:
                            module Integrations #:nodoc:
                              # Shop System Plugins - Terms of use
                              #
                              # This terms of use regulates warranty and liability between Wirecard Central Eastern Europe (subsequently referred to as WDCEE) and it's
                          Severity: Minor
                          Found in lib/offsite_payments/integrations/wirecard_checkout_page.rb - About 2 hrs to fix

                            File direc_pay.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            module OffsitePayments #:nodoc:
                              module Integrations #:nodoc:
                                module DirecPay
                                  mattr_accessor :production_url, :test_url
                            
                            
                            Severity: Minor
                            Found in lib/offsite_payments/integrations/direc_pay.rb - About 2 hrs to fix

                              Class Notification has 21 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                                    class Notification < OffsitePayments::Notification
                                      def generate_signature_string
                                        "#{uid}:#{gross}:#{gross_shop}:#{gross_client}:#{currency}:#{order_id}:#{payment_method_id}:#{payment_method_title}:#{client_email}:#{secret}"
                                      end
                              
                              
                              Severity: Minor
                              Found in lib/offsite_payments/integrations/megakassa.rb - About 2 hrs to fix

                                Method shipping_address has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                        def shipping_address(params = {})
                                          # Get the country code in the correct format
                                          # Use what we were given if we can't find anything
                                          country_code = lookup_country_code(params.delete(:country))
                                          add_field(mappings[:shipping_address][:country], country_code)
                                Severity: Minor
                                Found in lib/offsite_payments/integrations/paypal.rb - 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

                                Severity
                                Category
                                Status
                                Source
                                Language