assetricity/isbm_adaptor

View on GitHub

Showing 5 of 9 total issues

Method to_s has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def to_s
      date = []
      date << "#{@years}Y" unless @years.nil?
      date << "#{@months}M" unless @months.nil?
      date << "#{@days}D" unless @days.nil?
Severity: Minor
Found in lib/isbm_adaptor/duration.rb - About 2 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 open_session has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def open_session(uri, topics, listener_url = nil, xpath_expression = nil, xpath_namespaces = [])
Severity: Minor
Found in lib/isbm_adaptor/consumer_publication.rb - About 35 mins to fix

    Method open_session has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def open_session(uri, topics, listener_url = nil, xpath_expression = nil, xpath_namespaces = [])
    Severity: Minor
    Found in lib/isbm_adaptor/provider_request.rb - About 35 mins to fix

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

          def to_hash
            hash = {}
            hash[:years] = @years if @years
            hash[:months] = @months if @months
            hash[:days] = @days if @days
      Severity: Minor
      Found in lib/isbm_adaptor/duration.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 extract_message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def extract_message(response)
            # Extract the message element
            # e.g. /Envelope/Body/ReadPublicationResponse/PublicationMessage
            soap_ns = 'http://schemas.xmlsoap.org/soap/envelope/'
            message = response.doc.xpath('s:Envelope/s:Body', s: soap_ns).first.first_element_child.first_element_child
      Severity: Minor
      Found in lib/isbm_adaptor/client.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