SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,628 of 12,628 total issues

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

  def with_start_date
    if d = simple_date
      r = []
      r.push(table[:start_date_day].eq(d.day)) if d.day
      r.push(table[:start_date_month].eq(d.month)) if d.month
Severity: Minor
Found in lib/queries/concerns/date_ranges.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 integer_param has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def integer_param(params, attribute)
    return nil if attribute.nil? || params[attribute].nil?

    [params[attribute]].flatten.each do |v|
      next if v.kind_of?(Integer)
Severity: Minor
Found in lib/queries/helpers.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 fix_soft_validations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def fix_soft_validations
    return false if !soft_validated?
    soft_validations.soft_validations.each do |v|
      if fix = fix_for(v.soft_validation_method)
        if self.send(fix)
Severity: Minor
Found in lib/soft_validation.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

Avoid deeply nested control flow statements.
Open

                  d_value[:max] = o.sample_min if d_value[:max] < o.sample_min
Severity: Major
Found in lib/tools/interactive_key.rb - About 45 mins to fix

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

      def rows_with_filter
        return @rows_with_filter if !@rows_with_filter.nil?
        @rows_with_filter = [] if observation_matrix.nil?
        if !row_id_filter_array.nil?
          @rows_with_filter ||= observation_matrix.observation_matrix_rows.where(id: row_id_filter_array).order(:position)
    Severity: Minor
    Found in lib/tools/image_matrix.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

    Avoid deeply nested control flow statements.
    Open

                      d_value[:max] = o.sample_max if d_value[:max] < o.sample_max
    Severity: Major
    Found in lib/tools/interactive_key.rb - About 45 mins to fix

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

        def self.fixup_and_validate_characters_and_states(characters, file_name)
          characters.each_with_index do |c, i|
            if c.name.nil? || c.name == 'Undefined' # nexus_parser special string
              c.name = "Undefined (#{i + 1}) from (#{file_name})"
            end
      Severity: Minor
      Found in lib/vendor/nexus_parser.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 namecase_bibtex_entry has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.namecase_bibtex_entry(bibtex_entry)
            bibtex_entry.parse_names
            bibtex_entry.names.each do |n|
              n.first = NameCase(n.first) if n.first
              n.last = NameCase(n.last) if n.last
      Severity: Minor
      Found in lib/vendor/bibtex_ruby.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 from_parts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.from_parts(y, m, d)
          return '????/??/??' if y.nil? && m.nil? && d.nil?
          [y ? "#{y}" : '????',
           m ? "#{'%02d' % m}" : '??',
           d ? "#{'%02d' % d}" : '??'
      Severity: Minor
      Found in lib/utilities/dates.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

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

        def index
          respond_to do |format|
            format.html do
              @recent_objects = TaxonNameClassification.recent_from_project_id(sessions_current_project_id)
                .order(updated_at: :desc).limit(10)
      Severity: Major
      Found in app/controllers/taxon_name_classifications_controller.rb and 5 other locations - About 45 mins to fix
      app/controllers/common_names_controller.rb on lines 12..21
      app/controllers/downloads_controller.rb on lines 11..21
      app/controllers/origin_relationships_controller.rb on lines 8..18
      app/controllers/taxon_determinations_controller.rb on lines 8..17
      app/controllers/taxon_name_relationships_controller.rb on lines 9..19

      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 40.

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

        def self.invalid_month_day(trial)
          retval = false
          if trial[:start_date_day].to_i > 31 or trial[:end_date_day].to_i > 31
            retval = true
          end
      Severity: Minor
      Found in lib/utilities/dates.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 target_scope has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def target_scope(target = 'subject')
              a = send((target + '_otu_query').to_sym)
              b = send((target + '_collection_object_query').to_sym)
      
              a_sql, b_sql = nil, nil
      Severity: Minor
      Found in lib/queries/biological_association/filter.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 missing_other_names has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def missing_other_names
              a = missing_new_names.keys + low_probability_missing_new_names.keys
      
              n = {}
              missing_names.each do |k,v|
      Severity: Minor
      Found in lib/vendor/gnfinder/result.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 row_hash_initiate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def row_hash_initiate
          h = {}
          rows_with_filter.each do |r|
            otu_collection_object = r.observation_object_type + r.observation_object_id.to_s #  r.otu_id.to_s + '|' + r.collection_object_id.to_s
            h[otu_collection_object] = {}
      Severity: Minor
      Found in lib/tools/interactive_key.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

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

        def index
          respond_to do |format|
            format.html do
              @recent_objects = Download.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)
              render '/shared/data/all/index'
      Severity: Major
      Found in app/controllers/downloads_controller.rb and 5 other locations - About 45 mins to fix
      app/controllers/common_names_controller.rb on lines 12..21
      app/controllers/origin_relationships_controller.rb on lines 8..18
      app/controllers/taxon_determinations_controller.rb on lines 8..17
      app/controllers/taxon_name_classifications_controller.rb on lines 9..20
      app/controllers/taxon_name_relationships_controller.rb on lines 9..19

      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 40.

      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

        def index
          respond_to do |format|
            format.html{
              @recent_objects = OriginRelationship.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)
              render '/shared/data/all/index'
      Severity: Major
      Found in app/controllers/origin_relationships_controller.rb and 5 other locations - About 45 mins to fix
      app/controllers/common_names_controller.rb on lines 12..21
      app/controllers/downloads_controller.rb on lines 11..21
      app/controllers/taxon_determinations_controller.rb on lines 8..17
      app/controllers/taxon_name_classifications_controller.rb on lines 9..20
      app/controllers/taxon_name_relationships_controller.rb on lines 9..19

      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 40.

      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

        def index
          respond_to do |format|
            format.html do
              @recent_objects = TaxonNameRelationship.recent_from_project_id(sessions_current_project_id)
                .order(updated_at: :desc).limit(10)
      Severity: Major
      Found in app/controllers/taxon_name_relationships_controller.rb and 5 other locations - About 45 mins to fix
      app/controllers/common_names_controller.rb on lines 12..21
      app/controllers/downloads_controller.rb on lines 11..21
      app/controllers/origin_relationships_controller.rb on lines 8..18
      app/controllers/taxon_determinations_controller.rb on lines 8..17
      app/controllers/taxon_name_classifications_controller.rb on lines 9..20

      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 40.

      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

        def index
          respond_to do |format|
            format.html {
              @recent_objects = TaxonDetermination.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)
              render '/shared/data/all/index'
      Severity: Major
      Found in app/controllers/taxon_determinations_controller.rb and 5 other locations - About 45 mins to fix
      app/controllers/common_names_controller.rb on lines 12..21
      app/controllers/downloads_controller.rb on lines 11..21
      app/controllers/origin_relationships_controller.rb on lines 8..18
      app/controllers/taxon_name_classifications_controller.rb on lines 9..20
      app/controllers/taxon_name_relationships_controller.rb on lines 9..19

      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 40.

      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

        def index
          respond_to do |format|
            format.html do
              @recent_objects = CommonName.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)
              render '/shared/data/all/index'
      Severity: Major
      Found in app/controllers/common_names_controller.rb and 5 other locations - About 45 mins to fix
      app/controllers/downloads_controller.rb on lines 11..21
      app/controllers/origin_relationships_controller.rb on lines 8..18
      app/controllers/taxon_determinations_controller.rb on lines 8..17
      app/controllers/taxon_name_classifications_controller.rb on lines 9..20
      app/controllers/taxon_name_relationships_controller.rb on lines 9..19

      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 40.

      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 5 locations. Consider refactoring.
      Open

        def index
          respond_to do |format|
            format.html do
              @recent_objects = FieldOccurrence.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)
              render '/shared/data/all/index'
      Severity: Major
      Found in app/controllers/field_occurrences_controller.rb and 4 other locations - About 45 mins to fix
      app/controllers/biological_associations_graphs_controller.rb on lines 9..18
      app/controllers/containers_controller.rb on lines 9..19
      app/controllers/loans_controller.rb on lines 17..26
      app/controllers/taxon_names_controller.rb on lines 9..18

      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 40.

      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

      Severity
      Category
      Status
      Source
      Language