inossidabile/wash_out

View on GitHub

Showing 21 of 21 total issues

Method _render_soap has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def _render_soap(result, options)
      @namespace   = soap_config.namespace
      @operation   = soap_action = request.env['wash_out.soap_action']
      @action_spec = self.class.soap_actions[soap_action]

Severity: Minor
Found in lib/wash_out/dispatcher.rb - 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

Method load has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def load(data, key)
      if !data.has_key? key
        raise WashOut::Dispatcher::SOAPError, "Required SOAP parameter '#{key}' is missing"
      end

Severity: Minor
Found in lib/wash_out/param.rb - 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

Method wsdl_data has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def wsdl_data(xml, params)
    params.each do |param|
      next if param.attribute?

      tag_name = param.name
Severity: Minor
Found in app/helpers/wash_out_helper.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

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

  def wsdl_type(xml, param, defined=[])
    more = []

    if param.struct?
      if !defined.include?(param.basic_type)
Severity: Minor
Found in app/helpers/wash_out_helper.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

Method _render_soap has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def _render_soap(result, options)
      @namespace   = soap_config.namespace
      @operation   = soap_action = request.env['wash_out.soap_action']
      @action_spec = self.class.soap_actions[soap_action]

Severity: Minor
Found in lib/wash_out/dispatcher.rb - About 1 hr to fix

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

        def load(data, key)
          if !data.has_key? key
            raise WashOut::Dispatcher::SOAPError, "Required SOAP parameter '#{key}' is missing"
          end
    
    
    Severity: Minor
    Found in lib/wash_out/param.rb - About 1 hr to fix

      Method soap_action has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def soap_action(action, options={})
              if options[:as].present?
                options[:to] ||= action
                action = options[:as]
              end
      Severity: Minor
      Found in lib/wash_out/soap.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 parse_def has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.parse_def(soap_config, definition)
            raise RuntimeError, "[] should not be used in your params. Use nil if you want to mark empty set." if definition == []
            return [] if definition == nil
      
            if definition.is_a?(Class) && definition.ancestors.include?(WashOut::Type)
      Severity: Minor
      Found in lib/wash_out/param.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 parse_soap_action has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_soap_action(env)
            return env['wash_out.soap_action'] if env['wash_out.soap_action']
      
            soap_action = controller.soap_config.soap_action_routing ? env['HTTP_SOAPACTION'].to_s.gsub(/^"(.*)"$/, '\1')
                                                                     : ''
      Severity: Minor
      Found in lib/wash_out/router.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 wsdl_type has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def wsdl_type(xml, param, defined=[])
          more = []
      
          if param.struct?
            if !defined.include?(param.basic_type)
      Severity: Minor
      Found in app/helpers/wash_out_helper.rb - About 1 hr to fix

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

            def self.lookup_soap_routes(controller_name, routes, path=[], &block)
              routes.each do |x|
                defaults = x.defaults
                defaults = defaults[:defaults] if defaults.include?(:defaults) # Rails 5
                if defaults[:controller] == controller_name && defaults[:action] == 'soap'
        Severity: Minor
        Found in lib/wash_out/router.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 wsdl_data has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def wsdl_data(xml, params)
            params.each do |param|
              next if param.attribute?
        
              tag_name = param.name
        Severity: Minor
        Found in app/helpers/wash_out_helper.rb - About 1 hr to fix

          Method _strip_empty_nodes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def _strip_empty_nodes(params, hash)
                hash.keys.each do |key|
                  param = params.detect { |a| a.raw_name.to_s == key.to_s }
                  next if !(param && hash[key].is_a?(Hash))
          
          
          Severity: Minor
          Found in lib/wash_out/dispatcher.rb - About 55 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 map_struct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def map_struct(data)
                unless data.is_a?(Hash)
                  raise WashOut::Dispatcher::SOAPError, "SOAP message structure is broken"
                end
          
          
          Severity: Minor
          Found in lib/wash_out/param.rb - 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 deep_replace_href has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.deep_replace_href(element, replace)
                return element unless element.is_a?(Array) || element.is_a?(Hash)
          
                if element.is_a?(Array) # Traverse arrays
                  return element.map{|x| deep_replace_href(x, replace)}
          Severity: Minor
          Found in lib/wash_out/dispatcher.rb - 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

          Avoid too many return statements within this method.
          Open

                return false
          Severity: Major
          Found in lib/wash_out/wsse.rb - About 30 mins to fix

            Method deep_select has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.deep_select(collection, result=[], &blk)
                  values = collection.respond_to?(:values) ? collection.values : collection
                  result += values.select(&blk)
            
                  values.each do |value|
            Severity: Minor
            Found in lib/wash_out/dispatcher.rb - About 25 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 url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.url(request, controller_name)
                  lookup_soap_routes(controller_name, Rails.application.routes.routes) do |routes|
            
                    path = if routes.first.respond_to?(:optimized_path)      # Rails 4
                      routes.map(&:optimized_path)
            Severity: Minor
            Found in lib/wash_out/router.rb - About 25 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 wsdl_occurence has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def wsdl_occurence(param, inject, extend_with = {})
                data = {"#{'xsi:' if inject}nillable" => 'true'}
                if param.multiplied
                  data["#{'xsi:' if inject}minOccurs"] = 0
                  data["#{'xsi:' if inject}maxOccurs"] = 'unbounded'
            Severity: Minor
            Found in app/helpers/wash_out_helper.rb - About 25 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def initialize(soap_config, name, type, multiplied = false)
                  type ||= {}
                  @soap_config = soap_config
                  @name       = name.to_s
                  @raw_name   = name.to_s
            Severity: Minor
            Found in lib/wash_out/param.rb - About 25 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