IvanShamatov/sinatra-soap

View on GitHub

Showing 6 of 6 total issues

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

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

Severity: Minor
Found in lib/sinatra/soap/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 load has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in lib/sinatra/soap/param.rb - About 1 hr to fix

    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/sinatra/soap/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 wsdl_type has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def wsdl_type(xml, param, defined=[])
            param = Param.new(param[0], param[1])
            more = []
            if param.struct?
              if !defined.include?(param.basic_type)
    Severity: Minor
    Found in lib/sinatra/soap/helper_methods.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 registered has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.registered(app)
          app.helpers Soap::HelperMethods
    
          app.set :wsdl_route, '/wsdl' unless defined?(app.settings.wsdl_path)
          app.set :namespace, 'http://schemas.xmlsoap.org/wsdl/' unless defined?(app.settings.namespace)
    Severity: Minor
    Found in lib/sinatra/soap.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 wsdl_occurence has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def wsdl_occurence(param, inject, extend_with = {})
            param=Param.new(param[0], param[1])
            extend_with = { :name => param.name, :type => param.namespaced_type }
            data = !param.multiplied ? {} : {
              "#{'xsi:' if inject}minOccurs" => 0,
    Severity: Minor
    Found in lib/sinatra/soap/helper_methods.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