sshaw/jaxb2ruby

View on GitHub

Showing 8 of 8 total issues

Method extract_elements_nodes has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def extract_elements_nodes(klass)
      nodes = { :attributes => [], :children => [] }

      klass.declared_fields.each do |field|
        if field.annotation_present?(javax.xml.bind.annotation.XmlValue.java_class) || field.annotation_present?(javax.xml.bind.annotation.XmlMixed.java_class)
Severity: Minor
Found in lib/jaxb2ruby/converter.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 resolve_type has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve_type(field)
      return :ID if field.annotation_present?(javax.xml.bind.annotation.XmlID.java_class)
      return :IDREF if field.annotation_present?(javax.xml.bind.annotation.XmlIDREF.java_class)

      annot = field.get_annotation(javax.xml.bind.annotation.XmlSchemaType.java_class)
Severity: Minor
Found in lib/jaxb2ruby/converter.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 extract_elements_nodes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def extract_elements_nodes(klass)
      nodes = { :attributes => [], :children => [] }

      klass.declared_fields.each do |field|
        if field.annotation_present?(javax.xml.bind.annotation.XmlValue.java_class) || field.annotation_present?(javax.xml.bind.annotation.XmlMixed.java_class)
Severity: Minor
Found in lib/jaxb2ruby/converter.rb - About 1 hr to fix

    Method xjc has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def xjc
          options = @schema.end_with?(".wsdl") || @options[:wsdl] ? "-wsdl " : ""
          bindings = (@options[:bindings] || []).map { |binding| "-b #{binding}"}.join(" ")
          options << "-extension -npa -d :sources :schema -b :config #{bindings}"
          options << @options[:jvm].map { |opt| " -J#{opt}" }.join(" ") if @options[:jvm]
    Severity: Minor
    Found in lib/jaxb2ruby/xjc.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 find_namespace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def find_namespace(klass)
          annot = klass.get_annotation(javax.xml.bind.annotation.XmlRootElement.java_class) || klass.get_annotation(javax.xml.bind.annotation.XmlType.java_class)
          return unless annot
    
          # if klass is an inner class the namespace will be on the outter class (enclosing_class).
    Severity: Minor
    Found in lib/jaxb2ruby/converter.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(schema, options = {})
          raise ArgumentError, "cannot access schema: #{schema}" unless File.file?(schema) and File.readable?(schema)
          @xjc = XJC.new(schema, :xjc => options[:xjc], :wsdl => !!options[:wsdl], :jvm => options[:jvm], bindings: options[:bindings])
    
          @namespace = options[:namespace] || {}
    Severity: Minor
    Found in lib/jaxb2ruby/converter.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 create_ruby_classes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_ruby_classes
          java_classes = find_java_classes(@classes)
          raise Error, "no classes were generated from the schema" if java_classes.empty?
    
          $CLASSPATH << @classes unless $CLASSPATH.include?(@classes)
    Severity: Minor
    Found in lib/jaxb2ruby/converter.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(name, options = {})
          @name = @local_name = name
    
          @accessor = (options[:accessor] || name).underscore
          # If this conflicts with a Java keyword it will start with an underscore
    Severity: Minor
    Found in lib/jaxb2ruby/classes.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