projectcypress/health-data-standards

View on GitHub
lib/hqmf-parser/converter/pass1/data_criteria_converter.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method convert has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.convert(key, criteria)
 
      # @param [String] id
      # @param [String] title
      # @param [String] standard_category
Severity: Minor
Found in lib/hqmf-parser/converter/pass1/data_criteria_converter.rb - About 1 hr to fix

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

        def extract_group_data_criteria_tree(conjunction, preconditions, type, parent_id)
          
          children = []
          preconditions.each do |precondition|
            if (precondition.comparison?) 
    Severity: Minor
    Found in lib/hqmf-parser/converter/pass1/data_criteria_converter.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 create_group_data_criteria has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def create_group_data_criteria(preconditions, type, value, parent_id, id, standard_category, qds_data_type)
    Severity: Major
    Found in lib/hqmf-parser/converter/pass1/data_criteria_converter.rb - About 50 mins to fix

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

          def self.extract_data_criteria(preconditions, data_criteria_converter)
            flattened = []
            preconditions.each do |precondition|
              if (precondition.comparison?) 
                if (precondition.reference.id == HQMF::Document::MEASURE_PERIOD_ID)
      Severity: Minor
      Found in lib/hqmf-parser/converter/pass1/data_criteria_converter.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 convert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.convert(key, criteria)
       
            # @param [String] id
            # @param [String] title
            # @param [String] standard_category
      Severity: Minor
      Found in lib/hqmf-parser/converter/pass1/data_criteria_converter.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