lulibrary/puree

View on GitHub

Showing 20 of 44 total issues

Class ResearchOutput has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

    class ResearchOutput < Puree::XMLExtractor::Resource
      include Puree::XMLExtractor::AbstractMixin
      include Puree::XMLExtractor::KeywordMixin
      include Puree::XMLExtractor::OrganisationalUnitMixin
      include Puree::XMLExtractor::OwnerMixin
Severity: Minor
Found in lib/puree/xml_extractor/research_output.rb - About 2 hrs to fix

    Class Base has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Base
    
          # @param config [Hash]
          # @option config [String] :url URL of the Pure host
          # @option config [String] :username Username of the Pure host account
    Severity: Minor
    Found in lib/puree/rest/base.rb - About 2 hrs to fix

      Method address has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

            def address
              xpath_result = xpath_query '/addresses/address'
              if !xpath_result.empty?
                a = Puree::Model::Address.new
                street = xpath_result.xpath('street').text.strip
      Severity: Minor
      Found in lib/puree/xml_extractor/organisational_unit.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 persons has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

            def persons(type, xpath_query_path)
              xpath_result = xpath_query xpath_query_path
              arr = []
              xpath_result.each do |i|
                uuid_internal = i.at_xpath('person/@uuid')
      Severity: Minor
      Found in lib/puree/xml_extractor/mixins/person_mixin.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 normalise has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.normalise(data)
              if !data.nil? && !data.empty?
                date = {}
                year =  data['year']
                month = data['month']
      Severity: Minor
      Found in lib/puree/util/date.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 research_outputs has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def self.research_outputs(xml)
              path_from_root = File.join 'result/items', '/*'
              doc = Nokogiri::XML xml
              doc.remove_namespaces!
              xpath_result = doc.xpath path_from_root
      Severity: Minor
      Found in lib/puree/xml_extractor/collection.rb - About 1 hr to fix

        Method combine_metadata has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def combine_metadata
                super
                @model.bibliographical_note = bibliographical_note
                @model.category = category
                @model.description = description
        Severity: Minor
        Found in lib/puree/xml_extractor/research_output.rb - About 1 hr to fix

          Method persons has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def persons(type, xpath_query_path)
                  xpath_result = xpath_query xpath_query_path
                  arr = []
                  xpath_result.each do |i|
                    uuid_internal = i.at_xpath('person/@uuid')
          Severity: Minor
          Found in lib/puree/xml_extractor/mixins/person_mixin.rb - About 1 hr to fix

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

                  def self.iso(data)
                    iso_date = ''
                    year =  data['year']
                    month = data['month']
                    day = data['day']
            Severity: Minor
            Found in lib/puree/util/date.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 research_outputs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def self.research_outputs(xml)
                    path_from_root = File.join 'result/items', '/*'
                    doc = Nokogiri::XML xml
                    doc.remove_namespaces!
                    xpath_result = doc.xpath path_from_root
            Severity: Minor
            Found in lib/puree/xml_extractor/collection.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 name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def name
                    xpath_result = xpath_query '/name'
                    if !xpath_result.empty?
                      first = xpath_result.xpath('firstName').text.strip
                      last = xpath_result.xpath('lastName').text.strip
            Severity: Minor
            Found in lib/puree/xml_extractor/person.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 temporal_range has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def temporal_range(start_path, end_path)
                    range_start = xpath_query_for_single_value start_path
                    range_end = xpath_query_for_single_value end_path
                    if range_start || range_end
                      range = Puree::Model::TemporalRange.new
            Severity: Minor
            Found in lib/puree/xml_extractor/project.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 projects has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def projects
                    xpath_result = xpath_query '/relatedProjects/relatedProject'
                    data_arr = []
                    xpath_result.each { |i|
                      related = Puree::Model::RelatedContentHeader.new
            Severity: Minor
            Found in lib/puree/xml_extractor/mixins/project_mixin.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 other_names has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def other_names
                    xpath_result = xpath_query '/nameVariants/nameVariant/name'
                    data = []
                    xpath_result.each do |d|
                      first = xpath_result.xpath('firstName').text.strip
            Severity: Minor
            Found in lib/puree/xml_extractor/person.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 organisation_header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def self.organisation_header(nokogiri_xml_element)
                    h = Puree::Model::OrganisationalUnitHeader.new
                    h.uuid = nokogiri_xml_element.xpath('@uuid').text.strip
                    xpath_result_name = nokogiri_xml_element.xpath('name/text')
                    h.name = xpath_result_name.first.text.strip unless xpath_result_name.empty?
            Severity: Minor
            Found in lib/puree/xml_extractor/shared.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 event has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def event
                    xpath_result = xpath_query '/event'
                    if !xpath_result.empty?
                      header = Puree::Model::EventHeader.new
                      header.uuid = xpath_result.xpath('@uuid').text.strip
            Severity: Minor
            Found in lib/puree/xml_extractor/mixins/event_mixin.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 research_outputs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def research_outputs
                    xpath_result = xpath_query '/relatedResearchOutputs/relatedResearchOutput'
                    data_arr = []
                    xpath_result.each { |i|
                      related = Puree::Model::RelatedContentHeader.new
            Severity: Minor
            Found in lib/puree/xml_extractor/mixins/research_output_mixin.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 temporal_range has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def temporal_range(start_path, end_path)
                    range_start = Puree::Util::Date.hash_to_time temporal_date(start_path)
                    range_end = Puree::Util::Date.hash_to_time temporal_date(end_path)
                    if range_start || range_end
                      range = Puree::Model::TemporalRange.new
            Severity: Minor
            Found in lib/puree/xml_extractor/dataset.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 external_organisation_header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def self.external_organisation_header(nokogiri_xml_element)
                    h = Puree::Model::ExternalOrganisationHeader.new
                    h.uuid = nokogiri_xml_element.xpath('@uuid').text.strip
                    xpath_result_name = nokogiri_xml_element.xpath('name/text')
                    h.name = xpath_result_name.first.text.strip unless xpath_result_name.empty?
            Severity: Minor
            Found in lib/puree/xml_extractor/shared.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 publisher has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def publisher
                    xpath_result = xpath_query '/publisher'
                    h = Puree::Model::PublisherHeader.new
                    h.uuid = xpath_result.xpath('@uuid').text.strip
                    xpath_result_name = xpath_result.xpath('name/text')
            Severity: Minor
            Found in lib/puree/xml_extractor/mixins/publisher_mixin.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