projectcypress/health-data-standards

View on GitHub

Showing 318 of 318 total issues

Method import has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.import(xml_data, provider_map = {})
        doc = xml_data.kind_of?(Nokogiri::XML::Document) ? xml_data : Nokogiri::XML(xml_data)

        providers = []
        root_element_name = doc.root.name
Severity: Minor
Found in lib/health-data-standards/import/bulk_record_importer.rb - About 1 hr to fix

    Method to_json has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def to_json
          json = build_hash(self, [:title, :description, :hqmf_id, :hqmf_set_id, :hqmf_version_number])
          
          json[:data_criteria] = {}
          @data_criteria.each do |criteria|
    Severity: Minor
    Found in lib/hqmf-parser/1.0/document.rb - About 1 hr to fix

      Method import has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def self.import(zip,  options={})
                options = DEFAULTS.merge(options)
      
                bundle = nil
                Zip::ZipFile.open(zip.path) do |zip_file|
      Severity: Minor
      Found in lib/health-data-standards/import/bundle/importer.rb - About 1 hr to fix

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

          test "Performance Rate equals .285714 reported .285715" do
            errorsList = []
            population_ids = {}
            population_ids['NUMER'] = "test_numer"
            reported_result = {}
        Severity: Major
        Found in test/unit/validate/performance_rate_validator_test.rb and 5 other locations - About 1 hr to fix
        test/unit/validate/performance_rate_validator_test.rb on lines 25..39
        test/unit/validate/performance_rate_validator_test.rb on lines 98..112
        test/unit/validate/performance_rate_validator_test.rb on lines 132..146
        test/unit/validate/performance_rate_validator_test.rb on lines 149..163
        test/unit/validate/performance_rate_validator_test.rb on lines 166..180

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 56.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

          test "Performance Rate equals .285714 reported .2857142857" do
            errorsList = []
            population_ids = {}
            population_ids['NUMER'] = "test_numer"
            reported_result = {}
        Severity: Major
        Found in test/unit/validate/performance_rate_validator_test.rb and 5 other locations - About 1 hr to fix
        test/unit/validate/performance_rate_validator_test.rb on lines 25..39
        test/unit/validate/performance_rate_validator_test.rb on lines 98..112
        test/unit/validate/performance_rate_validator_test.rb on lines 115..129
        test/unit/validate/performance_rate_validator_test.rb on lines 132..146
        test/unit/validate/performance_rate_validator_test.rb on lines 166..180

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 56.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

          test "Performance Rate equals NA reported 1" do
            errorsList = []
            population_ids = {}
            population_ids['NUMER'] = "test_numer"
            reported_result = {}
        Severity: Major
        Found in test/unit/validate/performance_rate_validator_test.rb and 5 other locations - About 1 hr to fix
        test/unit/validate/performance_rate_validator_test.rb on lines 98..112
        test/unit/validate/performance_rate_validator_test.rb on lines 115..129
        test/unit/validate/performance_rate_validator_test.rb on lines 132..146
        test/unit/validate/performance_rate_validator_test.rb on lines 149..163
        test/unit/validate/performance_rate_validator_test.rb on lines 166..180

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 56.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

          test "Performance Rate equals .571429 reported .571428" do
            errorsList = []
            population_ids = {}
            population_ids['NUMER'] = "test_numer"
            reported_result = {}
        Severity: Major
        Found in test/unit/validate/performance_rate_validator_test.rb and 5 other locations - About 1 hr to fix
        test/unit/validate/performance_rate_validator_test.rb on lines 25..39
        test/unit/validate/performance_rate_validator_test.rb on lines 98..112
        test/unit/validate/performance_rate_validator_test.rb on lines 115..129
        test/unit/validate/performance_rate_validator_test.rb on lines 132..146
        test/unit/validate/performance_rate_validator_test.rb on lines 149..163

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 56.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

          test "Performance Rate equals .285714 reported 28.5714" do
            errorsList = []
            population_ids = {}
            population_ids['NUMER'] = "test_numer"
            reported_result = {}
        Severity: Major
        Found in test/unit/validate/performance_rate_validator_test.rb and 5 other locations - About 1 hr to fix
        test/unit/validate/performance_rate_validator_test.rb on lines 25..39
        test/unit/validate/performance_rate_validator_test.rb on lines 98..112
        test/unit/validate/performance_rate_validator_test.rb on lines 115..129
        test/unit/validate/performance_rate_validator_test.rb on lines 149..163
        test/unit/validate/performance_rate_validator_test.rb on lines 166..180

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 56.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 6 locations. Consider refactoring.
        Open

          test "Performance Rate equals .285714 reported 1.285714" do
            errorsList = []
            population_ids = {}
            population_ids['NUMER'] = "test_numer"
            reported_result = {}
        Severity: Major
        Found in test/unit/validate/performance_rate_validator_test.rb and 5 other locations - About 1 hr to fix
        test/unit/validate/performance_rate_validator_test.rb on lines 25..39
        test/unit/validate/performance_rate_validator_test.rb on lines 115..129
        test/unit/validate/performance_rate_validator_test.rb on lines 132..146
        test/unit/validate/performance_rate_validator_test.rb on lines 149..163
        test/unit/validate/performance_rate_validator_test.rb on lines 166..180

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 56.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method validate has 32 lines of code (exceeds 25 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 1 hr to fix

          Method backfill_patient_characteristics_with_codes has 32 lines of code (exceeds 25 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 1 hr to fix

            Method handle_stratifications has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def handle_stratifications(population_def, number_of_populations, population, id_def, population_index)
                  # handle stratifications (EP137, EP155)
                  stratifier_criteria_xpath = "cda:component/cda:stratifierCriteria[not(cda:component/cda:measureAttribute/cda:code[@code  = 'SDE'])]/.."
                  population_def.xpath(stratifier_criteria_xpath, HQMF2::Document::NAMESPACES)
                    .each_with_index do |criteria_def, criteria_def_index|
            Severity: Minor
            Found in lib/hqmf-parser/2.0/document_helpers/doc_population_helper.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 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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                  def render(params)
                    erb = nil
                    ident = nil
                    if params[:template]
                      erb = @template_helper.template(params[:template])
            Severity: Minor
            Found in lib/health-data-standards/export/rendering_context.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 get_source_data_criteria_list has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.get_source_data_criteria_list(full_criteria_list, data_criteria_references = {}, occurrences_map = {})
                  # currently, this will erase the sources if the ids are the same, but will not correct references later on
                  source_data_criteria = full_criteria_list.map do |entry|
                    SourceDataCriteriaHelper.as_source_data_criteria(entry, data_criteria_references, occurrences_map)
                  end
            Severity: Minor
            Found in lib/hqmf-parser/2.0/source_data_criteria_helper.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 test_api has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def test_api
                valueset_xml_by_date = {}
                doc_ng = {}
                valueset_xml_version = {}
            
            
            Severity: Minor
            Found in test/unit/util/vs_api_test.rb - About 1 hr to fix

              Method initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def initialize(hqmf_contents)
                    
                    @doc = Document.parse(hqmf_contents)
                    occurrence_counters = {}
                    @data_criteria = @doc.xpath('//cda:section[cda:code/@code="57025-9"]/cda:entry').collect do |entry|
              Severity: Minor
              Found in lib/hqmf-parser/1.0/document.rb - About 1 hr to fix

                Method data_criteria_template_name has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def data_criteria_template_name(data_criteria)
                        case data_criteria.definition
                        when 'diagnosis', 'diagnosis_family_history'
                          'condition_criteria'
                        when 'encounter'
                Severity: Minor
                Found in lib/hqmf-generator/hqmf-generator.rb - About 1 hr to fix

                  Method test_round_trip has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def test_round_trip
                      # Export
                      patient = Record.where({first: "Mary"}).first
                      start_date = Time.now.years_ago(1)
                      end_date = Time.now
                  Severity: Minor
                  Found in test/unit/roundtrip/cat_1_roundtrip_test.rb - About 1 hr to fix

                    Method categories has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def self.categories(measure_properties = [])
                            measure_properties = Array(measure_properties).map(&:to_s) | %w(
                              name description nqf_id cms_id hqmf_id continuous_variable episode_of_care
                            )
                            pipeline = []
                    Severity: Minor
                    Found in lib/health-data-standards/models/cqm/measure.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language