openjaf/cenit

View on GitHub
lib/cenit/xmlrpc.rb

Summary

Maintainability
C
1 day
Test Coverage

Method hash_decode has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

      def hash_decode(value)
        case value
        when Hash
          r = nil
          if value.size == 1
Severity: Minor
Found in lib/cenit/xmlrpc.rb - About 6 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 hash_decode has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def hash_decode(value)
        case value
        when Hash
          r = nil
          if value.size == 1
Severity: Major
Found in lib/cenit/xmlrpc.rb - About 2 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                      members = [members] unless members.is_a?(Array)
    Severity: Major
    Found in lib/cenit/xmlrpc.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                        values = [values] unless values.is_a?(Array)
      Severity: Major
      Found in lib/cenit/xmlrpc.rb - About 45 mins to fix

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

            def parse_method_response(xml)
              parsing_xml = Encoder.hash_decode(Hash.from_xml(xml))
              fail 'No valid method response!' if parsing_xml['methodName']
              parsing_xml = parsing_xml['methodResponse']
              if parsing_xml['fault']
        Severity: Minor
        Found in lib/cenit/xmlrpc.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 hash_encode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def hash_encode(value)
                {
                  value:
                    case value
                    when Integer
        Severity: Minor
        Found in lib/cenit/xmlrpc.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