projectcypress/health-data-standards

View on GitHub
lib/hqmf-parser/2.0/data_criteria.rb

Summary

Maintainability
C
1 day
Test Coverage

File data_criteria.rb has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module HQMF2
  # Represents a data criteria specification
  class DataCriteria
    include HQMF2::Utilities, HQMF2::DataCriteriaTypeAndDefinitionExtraction, HQMF2::DataCriteriaPostProcessing

Severity: Minor
Found in lib/hqmf-parser/2.0/data_criteria.rb - About 2 hrs to fix

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

        def clone
          other = DataCriteria.new(@entry, @data_criteria_references, @occurrences_map)
          other.instance_variable_set(:@id, @id)
          other.instance_variable_set(:@original_id, @original_id)
          other.instance_variable_set(:@property, @property)
    Severity: Minor
    Found in lib/hqmf-parser/2.0/data_criteria.rb - About 1 hr to fix

      Method extract_field_values has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.extract_field_values(entry, negation)
            fields = {}
            # extract most fields which use the same structure
            entry.xpath('./*/cda:outboundRelationship[*/cda:code]', HQMF2::Document::NAMESPACES).each do |field|
              code = HQMF2::Utilities.attr_val(field, './*/cda:code/@code')
      Severity: Minor
      Found in lib/hqmf-parser/2.0/data_criteria.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 duplicate_child_info has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def duplicate_child_info(child_ref)
            @title ||= child_ref.title
            @type ||= child_ref.subset_operators
            @definition ||= child_ref.definition
            @status ||= child_ref.status
      Severity: Minor
      Found in lib/hqmf-parser/2.0/data_criteria.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 to_model has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def to_model
            mv = value.try(:to_model)
            met = effective_time.try(:to_model)
            mtr = temporal_references.collect(&:to_model)
            mso = subset_operators.collect(&:to_model)
      Severity: Minor
      Found in lib/hqmf-parser/2.0/data_criteria.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 retrieve_field_values_model_for_model has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def retrieve_field_values_model_for_model
            field_values = {}
            @field_values.each_pair do |id, val|
              field_values[id] = val.to_model
            end
      Severity: Minor
      Found in lib/hqmf-parser/2.0/data_criteria.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 extract_description has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def extract_description
            if @variable
              encoded_name = attr_val('./cda:localVariableName/@value')
              encoded_name = DataCriteriaMethods.extract_description_for_variable(encoded_name) if encoded_name
              return encoded_name if encoded_name.present?
      Severity: Minor
      Found in lib/hqmf-parser/2.0/data_criteria.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 extract_variable_grouper has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def extract_variable_grouper
            return unless @variable
            @variable = false
            @id = "GROUP_#{@id}"
            if @children_criteria.length == 1 && @children_criteria[0] =~ /GROUP_/
      Severity: Minor
      Found in lib/hqmf-parser/2.0/data_criteria.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