projectcypress/health-data-standards

View on GitHub

Showing 318 of 318 total issues

Method test_to_json_0002 has 234 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def test_to_json_0002

      codes = {
        "2.16.840.1.113883.3.560.100.2" => {"HL7"=>["F"]},
        "2.16.840.1.113883.1.11.1" => {"HL7" => ["M","F","UN"]},
Severity: Major
Found in test/unit/hqmf/model/nqf_0002_test.rb - About 1 day to fix

    Method walk_up_tree has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
    Open

        def walk_up_tree(preconditions)
          preconditions.each do |precondition|
            if (has_child_comparison(precondition))
              walk_up_tree(precondition.preconditions)
            end
    Severity: Minor
    Found in lib/hqmf-parser/converter/pass2/comparison_converter.rb - About 1 day 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 build_sub_measures has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_sub_measures()
          @sub_measures = []
          ipps = @population_criteria_by_id.select {|key, value| value.type == HQMF::PopulationCriteria::IPP}
          denoms = @population_criteria_by_id.select {|key, value| value.type == HQMF::PopulationCriteria::DENOM}
          nums = @population_criteria_by_id.select {|key, value| value.type == HQMF::PopulationCriteria::NUMER}
    Severity: Minor
    Found in lib/hqmf-parser/converter/pass1/population_criteria_converter.rb - About 7 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 backfill_patient_characteristics_with_codes has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

        def backfill_patient_characteristics_with_codes(codes)
          
          [].concat(self.all_data_criteria).concat(self.source_data_criteria).each do |data_criteria|
            if (data_criteria.type == :characteristic and !data_criteria.property.nil?)
              if (codes)
    Severity: Minor
    Found in lib/hqmf-model/document.rb - About 6 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 diff_hash has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

      def diff_hash(other, ignore_id=false, clean_reference=true)
        (self.keys | other.keys).inject({}) do |diff, k|
          left = self[k]
          right = other[k]
          right = right.gsub(/_precondition_\d+/, '') if (right && k==:reference && clean_reference)
    Severity: Minor
    Found in test/test_helper.rb - About 5 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 validate has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.validate(document,codes)
          puts "\t(#{document.id})document is nil!!!!!!!!!!!" unless document
          puts "\t(#{document.id})codes are nil!!!!!!!!!!!" unless codes
          return unless document and codes
          
    Severity: Minor
    Found in lib/hqmf-parser/converter/pass1/document_converter.rb - About 5 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 extract_preconditions_from_restriction has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.extract_preconditions_from_restriction(restriction,data_criteria_converter)
          target_id=nil
          if restriction[:target_id] and data_criteria_converter.v1_data_criteria_by_id[restriction[:target_id]]
            target_id = data_criteria_converter.v1_data_criteria_by_id[restriction[:target_id]].id
          elsif restriction[:target_id]
    Severity: Minor
    Found in lib/hqmf-parser/converter/pass1/precondition_extractor.rb - About 5 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

    Class ErbContext has 36 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class ErbContext < OpenStruct
    
    
          def initialize(vars)
            super(vars)
    Severity: Minor
    Found in lib/hqmf-generator/hqmf-generator.rb - About 4 hrs to fix

      Method entries_for_data_criteria has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

              def entries_for_data_criteria(data_criteria, patient)
      
                data_criteria_oid = HQMFTemplateHelper.template_id_by_definition_and_status(data_criteria.definition,
                                                                                            data_criteria.status || '',
                                                                                             data_criteria.negation)
      Severity: Minor
      Found in lib/health-data-standards/export/helper/scooped_view_helper.rb - About 4 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

      File hqmf-generator.rb has 353 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module HQMF2
        module Generator
      
          def self.render_template(name, params)
            template_path = File.expand_path(File.join('..', "#{name}.xml.erb"), __FILE__)
      Severity: Minor
      Found in lib/hqmf-generator/hqmf-generator.rb - About 4 hrs to fix

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

        module HQMF
          # Represents a data criteria specification
          class DataCriteria
        
            include HQMF::Conversion::Utilities
        Severity: Minor
        Found in lib/hqmf-model/data_criteria.rb - About 4 hrs to fix

          File nqf_0002_test.rb has 338 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require_relative '../../../test_helper'
          module HQMFModel
          
            class NQF0002Test  < Minitest::Test    
              def setup
          Severity: Minor
          Found in test/unit/hqmf/model/nqf_0002_test.rb - About 4 hrs to fix

            Method data_criteria_matches has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

                def data_criteria_matches(expected, actual)
                  matches = true
            
                  matches &&= actual[:description] == expected[:description]
                  matches &&= expected[:code_list_id] == actual[:code_list_id]
            Severity: Minor
            Found in test/unit/hqmf/model/nqf_0002_test.rb - About 4 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

            File types.rb has 321 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module HQMF2
              # Used to represent 'any value' in criteria that require a value be present but
              # don't specify any restrictions on that value
              class AnyValue
                attr_reader :type
            Severity: Minor
            Found in lib/hqmf-parser/2.0/types.rb - About 3 hrs to fix

              Method test_roundtrip has 90 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def test_roundtrip
                  assert_equal 'foo', @model.id
                  assert_equal "Statin Prescribed at Discharge", @model.title.strip
                  assert_equal "Acute myocardial infarction (AMI) patients who are prescribed a statin at hospital discharge.", @model.description.strip
                  data_criteria = @model.all_data_criteria
              Severity: Major
              Found in test/unit/hqmf/2.0/document_v2_test.rb - About 3 hrs to fix

                Class PatientImporterTest has 29 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class PatientImporterTest < Minitest::Test
                
                  def test_care_goal
                    patient = build_record_from_xml('test/fixtures/cat1_fragments/care_goal_fragment.xml')
                    care_goal = patient.care_goals.first
                Severity: Minor
                Found in test/unit/import/cat1/patient_importer_test.rb - About 3 hrs to fix

                  Method unique_data_criteria has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def unique_data_criteria(measures, r2_compatibility)
                            all_data_criteria = measures.map {|measure| measure.all_data_criteria}.flatten
                            mapped_data_criteria = {}
                  
                            all_data_criteria.each do |data_criteria|
                  Severity: Minor
                  Found in lib/health-data-standards/export/helper/scooped_view_helper.rb - About 3 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 build_pre_filters! has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def build_pre_filters!
                          dc = self.data_criteria.inject({}) do |all_dc, single_dc|
                            key = single_dc.keys.first
                            value = single_dc.values.first
                            all_dc[key] = value
                  Severity: Minor
                  Found in lib/health-data-standards/models/cqm/measure.rb - About 3 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 extract_preconditions_from_restriction has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def self.extract_preconditions_from_restriction(restriction,data_criteria_converter)
                        target_id=nil
                        if restriction[:target_id] and data_criteria_converter.v1_data_criteria_by_id[restriction[:target_id]]
                          target_id = data_criteria_converter.v1_data_criteria_by_id[restriction[:target_id]].id
                        elsif restriction[:target_id]
                  Severity: Major
                  Found in lib/hqmf-parser/converter/pass1/precondition_extractor.rb - About 3 hrs to fix

                    File types.rb has 305 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    module HQMF
                    
                      # Used to represent 'any value' in criteria that require a value be present but
                      # don't specify any restrictions on that value
                      class AnyValue
                    Severity: Minor
                    Found in lib/hqmf-model/types.rb - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language