GeoCerts/geocerts

View on GitHub

Showing 10 of 18 total issues

Method included has 113 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.included(base)
        base.class_eval do
          endpoint GeoCerts::API::ENDPOINT do

            action :orders, :url => '/orders.xml' do
Severity: Major
Found in lib/geo_certs/endpoints/orders.rb - About 4 hrs to fix

    Method xml_node_to_hash has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

            def xml_node_to_hash(node) 
              # If we are at the root of the document, start the hash 
              if node.element? 
               if node.children? 
                  result_hash = {} 
    Severity: Minor
    Found in lib/geo_certs/hash_extension.rb - About 3 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

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

      class Order < ApiObject
    
        attr_accessor :approver_email,
                      :approver_confirmed_at,
                      :approver_notified_at,
    Severity: Minor
    Found in lib/geo_certs/order.rb - About 3 hrs to fix

      Method included has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def self.included(base)
              base.class_eval do
                endpoint GeoCerts::API::ENDPOINT do
                  action :query_fraud_score, :url => '/fraud_score.xml', :method => :post do
                    parameter 'fraud_score[ip]', :required => true, :as => :ip
      Severity: Minor
      Found in lib/geo_certs/endpoints/fraud_scores.rb - About 1 hr to fix

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

              def self.included(base)
                base.class_eval do
                  endpoint GeoCerts::API::ENDPOINT do
                    
                    action :events, :url => '/events.xml' do
        Severity: Minor
        Found in lib/geo_certs/endpoints/events.rb - About 1 hr to fix

          Method included has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def self.included(base)
                  base.class_eval do
                    endpoint GeoCerts::API::ENDPOINT do
                      
                      action :certificates, :url => '/certificates.xml' do
          Severity: Minor
          Found in lib/geo_certs/endpoints/certificates.rb - About 1 hr to fix

            Method create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def create
                  parameters = {}
                  parameters[:approver_email]   = GeoCerts.escape(self.approver_email)
                  parameters[:years]            = GeoCerts.escape(self.years)
                  parameters[:licenses]         = GeoCerts.escape(self.licenses)
            Severity: Minor
            Found in lib/geo_certs/order.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

            Method xml_node_to_hash has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def xml_node_to_hash(node) 
                      # If we are at the root of the document, start the hash 
                      if node.element? 
                       if node.children? 
                          result_hash = {} 
            Severity: Minor
            Found in lib/geo_certs/hash_extension.rb - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                                  if result_hash[child.name].is_a?(Object::Array)
                                    result_hash[child.name] << result
                                  else
                                    result_hash[child.name] = [result_hash[child.name]] << result
                                  end
              Severity: Major
              Found in lib/geo_certs/hash_extension.rb - About 45 mins to fix

                Method validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def validate
                      parameters = {}
                      parameters[:years]        = self.years
                      parameters[:licenses]     = self.licenses
                      parameters[:sans]         = GeoCerts.escape(self.sans) if self.sans
                Severity: Minor
                Found in lib/geo_certs/order.rb - About 35 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

                Severity
                Category
                Status
                Source
                Language