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'
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|
- Read upRead up
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"
- Read upRead up
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)
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|
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"
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
- Read upRead up
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
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)
- Read upRead up
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 ||= {}
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)
- Read upRead up
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)
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
- Read upRead up
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
- Read upRead up
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 ||= {}
- Read upRead up
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"