projectcypress/health-data-standards

View on GitHub
lib/hqmf-parser/2.0/data_criteria_helpers/dc_definition_from_template_or_type_extract.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method definition_for_nil_entry has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def definition_for_nil_entry
      reference = @entry.at_xpath('./*/cda:outboundRelationship/cda:criteriaReference', HQMF2::Document::NAMESPACES)
      ref_id = nil
      unless reference.nil?
        ref_id = "#{HQMF2::Utilities.attr_val(reference, 'cda:id/@extension')}_#{HQMF2::Utilities.attr_val(reference, 'cda:id/@root')}"

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 handle_entry_type has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_entry_type(entry_type)
      # settings is required to trigger exceptions, which set the definition
      HQMF::DataCriteria.get_settings_for_definition(entry_type, @status)
      @definition = entry_type
    rescue

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 definition_for_nil_entry has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def definition_for_nil_entry
      reference = @entry.at_xpath('./*/cda:outboundRelationship/cda:criteriaReference', HQMF2::Document::NAMESPACES)
      ref_id = nil
      unless reference.nil?
        ref_id = "#{HQMF2::Utilities.attr_val(reference, 'cda:id/@extension')}_#{HQMF2::Utilities.attr_val(reference, 'cda:id/@root')}"

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

        def extract_definition_from_template_id
          found = false
    
          @template_ids.each do |template_id|
            defs = HQMF::DataCriteria.definition_for_template_id(template_id, 'r2')

    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_information_for_specific_variable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def extract_information_for_specific_variable
          reference = @entry.at_xpath('./*/cda:outboundRelationship/cda:criteriaReference',
                                      HQMF2::Document::NAMESPACES)
          if reference
            ref_id = strip_tokens(

    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