projectcypress/health-data-standards

View on GitHub
lib/hqmf-parser/2.0/document_helpers/doc_utilities.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method detect_criteria_covered_by_criteria has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def detect_criteria_covered_by_criteria(data_criteria, check_criteria)
      base_checks = true

      # Check whether basic features are the same
      base_checks &&= data_criteria.definition == check_criteria.definition # same definition
Severity: Minor
Found in lib/hqmf-parser/2.0/document_helpers/doc_utilities.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 handle_variable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_variable(data_criteria, collapsed_source_data_criteria)

      if data_criteria.is_derived_specific_occurrence_variable
        data_criteria.handle_derived_specific_occurrence_variable
        extract_source_data_criteria(data_criteria)
Severity: Minor
Found in lib/hqmf-parser/2.0/document_helpers/doc_utilities.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 extract_source_data_criteria has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def extract_source_data_criteria (data_criteria)
      # check if we have temporal references other non-SDC elements on this data criteria.
      # if we do, we need to create a new SDC to reference
      if !SourceDataCriteriaHelper.already_stripped?(data_criteria)
        candidate_sdc = SourceDataCriteriaHelper.strip_non_sc_elements(data_criteria.clone)
Severity: Minor
Found in lib/hqmf-parser/2.0/document_helpers/doc_utilities.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 criteria_covered_by_criteria? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def criteria_covered_by_criteria?(dc)
      @reference_ids.uniq

      base_criteria_defs = %w(patient_characteristic_ethnicity patient_characteristic_gender patient_characteristic_payer patient_characteristic_race)
      to_reject = true
Severity: Minor
Found in lib/hqmf-parser/2.0/document_helpers/doc_utilities.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