rubyjedi/soap4r

View on GitHub
lib/wsdl/soap/classDefCreator.rb

Summary

Maintainability
F
3 days
Test Coverage

File classDefCreator.rb has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'wsdl/data'
require 'wsdl/soap/classDefCreatorSupport'
require 'xsd/codegen'
require 'set'

Severity: Minor
Found in lib/wsdl/soap/classDefCreator.rb - About 5 hrs to fix

    Method parse_elements has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

      def parse_elements(c, elements, base_namespace, mpath, as_array = false)
        init_lines = []
        init_params = []
        any = false
        elements.each do |element|
    Severity: Minor
    Found in lib/wsdl/soap/classDefCreator.rb - About 5 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 dump has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

      def dump(type = nil)
        result = "require 'xsd/qname'\n"
        # cannot use @modulepath because of multiple classes
        if @modulepath
          result << "\n"
    Severity: Minor
    Found in lib/wsdl/soap/classDefCreator.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 ClassDefCreator has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ClassDefCreator
      include ClassDefCreatorSupport
      include XSD::CodeGen
    
      def initialize(definitions, name_creator, modulepath = nil)
    Severity: Minor
    Found in lib/wsdl/soap/classDefCreator.rb - About 2 hrs to fix

      Method parse_elements has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def parse_elements(c, elements, base_namespace, mpath, as_array = false)
          init_lines = []
          init_params = []
          any = false
          elements.each do |element|
      Severity: Major
      Found in lib/wsdl/soap/classDefCreator.rb - About 2 hrs to fix

        Method dump has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def dump(type = nil)
            result = "require 'xsd/qname'\n"
            # cannot use @modulepath because of multiple classes
            if @modulepath
              result << "\n"
        Severity: Minor
        Found in lib/wsdl/soap/classDefCreator.rb - About 1 hr to fix

          Method create_structdef has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def create_structdef(mpath, qname, typedef, qualified = false)
              classname = mapped_class_basename(qname, mpath)
              baseclassname = nil
              if typedef.complexcontent
                if base = typedef.complexcontent.base
          Severity: Minor
          Found in lib/wsdl/soap/classDefCreator.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 create_structdef has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def create_structdef(mpath, qname, typedef, qualified = false)
              classname = mapped_class_basename(qname, mpath)
              baseclassname = nil
              if typedef.complexcontent
                if base = typedef.complexcontent.base
          Severity: Minor
          Found in lib/wsdl/soap/classDefCreator.rb - About 1 hr to fix

            Method dump_element has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def dump_element(target = nil)
                @elements.collect { |ele|
                  next if @complextypes[ele.name]
                  next if target and target != ele.name
                  c = create_elementdef(@modulepath, ele)
            Severity: Minor
            Found in lib/wsdl/soap/classDefCreator.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 define_attribute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def define_attribute(c, attributes)
                const = {}
                unless attributes.empty?
                  c.def_method("__xmlattr") do <<-__EOD__
                      @__xmlattr ||= {}
            Severity: Minor
            Found in lib/wsdl/soap/classDefCreator.rb - About 1 hr to fix

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

                def dump_attribute(target = nil)
                  @attributes.collect { |attribute|
                    next if target and target != attribute.name
                    if attribute.local_simpletype
                      c = create_simpletypedef(@modulepath, attribute.name, attribute.local_simpletype)
              Severity: Minor
              Found in lib/wsdl/soap/classDefCreator.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 parse_elements has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def parse_elements(c, elements, base_namespace, mpath, as_array = false)
              Severity: Minor
              Found in lib/wsdl/soap/classDefCreator.rb - About 35 mins to fix

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

                  def dump_complextype(target = nil)
                    definitions = sort_dependency(@complextypes).collect { |type|
                      next if target and target != type.name
                      c = create_complextypedef(@modulepath, type.name, type)
                      c ? c.dump : nil
                Severity: Minor
                Found in lib/wsdl/soap/classDefCreator.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

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

                  def dump_simpletype(target = nil)
                    @simpletypes.collect { |type|
                      next if target and target != type.name
                      c = create_simpletypedef(@modulepath, type.name, type)
                      c ? c.dump : nil
                Severity: Minor
                Found in lib/wsdl/soap/classDefCreator.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

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

                  def define_attribute(c, attributes)
                    const = {}
                    unless attributes.empty?
                      c.def_method("__xmlattr") do <<-__EOD__
                          @__xmlattr ||= {}
                Severity: Minor
                Found in lib/wsdl/soap/classDefCreator.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

                There are no issues that match your filters.

                Category
                Status