SpeciesFileGroup/taxonworks

View on GitHub
app/helpers/taxon_names/paper_catalog_helper.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method has too many lines. [28/25]
Open

  def paper_distribution_row(entry_item)
    o = case entry_item.object.class.name
    when 'TypeMaterial'
      entry_item.object.collection_object
    else

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

  def paper_history_type_material(entry_item)
    return nil if entry_item.object_class != 'Protonym' || !entry_item.is_first # is_subsequent?

    # Species type
    if entry_item.object.is_species_rank?
Severity: Minor
Found in app/helpers/taxon_names/paper_catalog_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 paper_distribution_row has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def paper_distribution_row(entry_item)
    o = case entry_item.object.class.name
    when 'TypeMaterial'
      entry_item.object.collection_object
    else
Severity: Minor
Found in app/helpers/taxon_names/paper_catalog_helper.rb - About 1 hr to fix

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

      def recursive_catalog_tag(taxon_name, data = { body: '', sources: [], supplementary_distribution: ::Catalog::Distribution::Entry.new([]), repositories: [], options: OPTIONS}, depth = 0 )
    
        data[:body] << [
          paper_header_prefix(taxon_name, data[:options]),
          full_taxon_name_tag(taxon_name),
    Severity: Minor
    Found in app/helpers/taxon_names/paper_catalog_helper.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 paper_header_prefix has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def paper_header_prefix(taxon_name, options)
        r = nil
        if options[:nest_rank_headers]
          if taxon_name.type == 'Combination'
            r = :combination
    Severity: Minor
    Found in app/helpers/taxon_names/paper_catalog_helper.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 paper_repositories has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def paper_repositories(entry_item)
        return nil if entry_item.object_class != 'Protonym' || !entry_item.is_first || !entry_item.object.is_species_rank?
        types = entry_item.object.get_primary_type
        repositories = []
        if types.any?
    Severity: Minor
    Found in app/helpers/taxon_names/paper_catalog_helper.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

    Method paper_history_subject_original_citation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def paper_history_subject_original_citation(catalog_item)
        return nil if !catalog_item.from_relationship? || catalog_item.object.subject_taxon_name.origin_citation.blank?
        return nil if catalog_item.from_relationship?
        t = catalog_item.object.subject_taxon_name
        c = t.origin_citation
    Severity: Minor
    Found in app/helpers/taxon_names/paper_catalog_helper.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

    Method paper_history_statuses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def paper_history_statuses(nomenclature_catalog_entry_item)
        i = nomenclature_catalog_entry_item
        s = i.base_object.taxon_name_classifications_for_statuses
        return nil if (s.empty? || !i.is_first) # is_subsequent?
        return nil if i.from_relationship?
    Severity: Minor
    Found in app/helpers/taxon_names/paper_catalog_helper.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

    Tagging a string as html safe may be a security risk.
    Open

        ].compact.join.html_safe

    This cop checks for the use of output safety calls like html_safe, raw, and safe_concat. These methods do not escape content. They simply return a SafeBuffer containing the content as is. Instead, use safe_join to join content and escape it and concat to concatenate content and escape it, ensuring its safety.

    Example:

    user_content = "hi"
    
    # bad
    "

    #{user_content}

    ".html_safe # => ActiveSupport::SafeBuffer "

    hi

    " # good content_tag(:p, user_content) # => ActiveSupport::SafeBuffer "

    <b>hi</b>

    " # bad out = "" out << "
  • #{user_content}
  • " out << "
  • #{user_content}
  • " out.html_safe # => ActiveSupport::SafeBuffer "
  • hi
  • hi
  • " # good out = [] out << content_tag(:li, user_content) out << content_tag(:li, user_content) safe_join(out) # => ActiveSupport::SafeBuffer # "
  • <b>hi</b>
  • <b>hi</b>
  • " # bad out = "

    trusted content

    ".html_safe out.safe_concat(user_content) # => ActiveSupport::SafeBuffer "

    trusted_content

    hi" # good out = "

    trusted content

    ".html_safe out.concat(user_content) # => ActiveSupport::SafeBuffer # "

    trusted_content

    <b>hi</b>" # safe, though maybe not good style out = "trusted content" result = out.concat(user_content) # => String "trusted contenthi" # because when rendered in ERB the String will be escaped: # <%= result %> # => trusted content<b>hi</b> # bad (user_content + " " + content_tag(:span, user_content)).html_safe # => ActiveSupport::SafeBuffer "hi <span><b>hi</b></span>" # good safe_join([user_content, " ", content_tag(:span, user_content)]) # => ActiveSupport::SafeBuffer # "<b>hi</b> <span>&lt;b&gt;hi&lt;/b&gt;</span>"

    Tagging a string as html safe may be a security risk.
    Open

            data[:body] << [ paper_catalog_li_tag(c, cat.object, :browse_nomenclature_task_path), "\n\n"].join.html_safe

    This cop checks for the use of output safety calls like html_safe, raw, and safe_concat. These methods do not escape content. They simply return a SafeBuffer containing the content as is. Instead, use safe_join to join content and escape it and concat to concatenate content and escape it, ensuring its safety.

    Example:

    user_content = "hi"
    
    # bad
    "

    #{user_content}

    ".html_safe # => ActiveSupport::SafeBuffer "

    hi

    " # good content_tag(:p, user_content) # => ActiveSupport::SafeBuffer "

    <b>hi</b>

    " # bad out = "" out << "
  • #{user_content}
  • " out << "
  • #{user_content}
  • " out.html_safe # => ActiveSupport::SafeBuffer "
  • hi
  • hi
  • " # good out = [] out << content_tag(:li, user_content) out << content_tag(:li, user_content) safe_join(out) # => ActiveSupport::SafeBuffer # "
  • <b>hi</b>
  • <b>hi</b>
  • " # bad out = "

    trusted content

    ".html_safe out.safe_concat(user_content) # => ActiveSupport::SafeBuffer "

    trusted_content

    hi" # good out = "

    trusted content

    ".html_safe out.concat(user_content) # => ActiveSupport::SafeBuffer # "

    trusted_content

    <b>hi</b>" # safe, though maybe not good style out = "trusted content" result = out.concat(user_content) # => String "trusted contenthi" # because when rendered in ERB the String will be escaped: # <%= result %> # => trusted content<b>hi</b> # bad (user_content + " " + content_tag(:span, user_content)).html_safe # => ActiveSupport::SafeBuffer "hi <span><b>hi</b></span>" # good safe_join([user_content, " ", content_tag(:span, user_content)]) # => ActiveSupport::SafeBuffer # "<b>hi</b> <span>&lt;b&gt;hi&lt;/b&gt;</span>"

    Tagging a string as html safe may be a security risk.
    Open

            ].compact.join.html_safe

    This cop checks for the use of output safety calls like html_safe, raw, and safe_concat. These methods do not escape content. They simply return a SafeBuffer containing the content as is. Instead, use safe_join to join content and escape it and concat to concatenate content and escape it, ensuring its safety.

    Example:

    user_content = "hi"
    
    # bad
    "

    #{user_content}

    ".html_safe # => ActiveSupport::SafeBuffer "

    hi

    " # good content_tag(:p, user_content) # => ActiveSupport::SafeBuffer "

    <b>hi</b>

    " # bad out = "" out << "
  • #{user_content}
  • " out << "
  • #{user_content}
  • " out.html_safe # => ActiveSupport::SafeBuffer "
  • hi
  • hi
  • " # good out = [] out << content_tag(:li, user_content) out << content_tag(:li, user_content) safe_join(out) # => ActiveSupport::SafeBuffer # "
  • <b>hi</b>
  • <b>hi</b>
  • " # bad out = "

    trusted content

    ".html_safe out.safe_concat(user_content) # => ActiveSupport::SafeBuffer "

    trusted_content

    hi" # good out = "

    trusted content

    ".html_safe out.concat(user_content) # => ActiveSupport::SafeBuffer # "

    trusted_content

    <b>hi</b>" # safe, though maybe not good style out = "trusted content" result = out.concat(user_content) # => String "trusted contenthi" # because when rendered in ERB the String will be escaped: # <%= result %> # => trusted content<b>hi</b> # bad (user_content + " " + content_tag(:span, user_content)).html_safe # => ActiveSupport::SafeBuffer "hi <span><b>hi</b></span>" # good safe_join([user_content, " ", content_tag(:span, user_content)]) # => ActiveSupport::SafeBuffer # "<b>hi</b> <span>&lt;b&gt;hi&lt;/b&gt;</span>"

    Tagging a string as html safe may be a security risk.
    Open

           tnc.classification_label + (tnc.citations.load.any? ? (' in ' + citations_tag(tnc)).html_safe : '')

    This cop checks for the use of output safety calls like html_safe, raw, and safe_concat. These methods do not escape content. They simply return a SafeBuffer containing the content as is. Instead, use safe_join to join content and escape it and concat to concatenate content and escape it, ensuring its safety.

    Example:

    user_content = "hi"
    
    # bad
    "

    #{user_content}

    ".html_safe # => ActiveSupport::SafeBuffer "

    hi

    " # good content_tag(:p, user_content) # => ActiveSupport::SafeBuffer "

    <b>hi</b>

    " # bad out = "" out << "
  • #{user_content}
  • " out << "
  • #{user_content}
  • " out.html_safe # => ActiveSupport::SafeBuffer "
  • hi
  • hi
  • " # good out = [] out << content_tag(:li, user_content) out << content_tag(:li, user_content) safe_join(out) # => ActiveSupport::SafeBuffer # "
  • <b>hi</b>
  • <b>hi</b>
  • " # bad out = "

    trusted content

    ".html_safe out.safe_concat(user_content) # => ActiveSupport::SafeBuffer "

    trusted_content

    hi" # good out = "

    trusted content

    ".html_safe out.concat(user_content) # => ActiveSupport::SafeBuffer # "

    trusted_content

    <b>hi</b>" # safe, though maybe not good style out = "trusted content" result = out.concat(user_content) # => String "trusted contenthi" # because when rendered in ERB the String will be escaped: # <%= result %> # => trusted content<b>hi</b> # bad (user_content + " " + content_tag(:span, user_content)).html_safe # => ActiveSupport::SafeBuffer "hi <span><b>hi</b></span>" # good safe_join([user_content, " ", content_tag(:span, user_content)]) # => ActiveSupport::SafeBuffer # "<b>hi</b> <span>&lt;b&gt;hi&lt;/b&gt;</span>"

    Tagging a string as html safe may be a security risk.
    Open

          " (#{catalog_item.object.subject_status_tag} #{other_str})".html_safe

    This cop checks for the use of output safety calls like html_safe, raw, and safe_concat. These methods do not escape content. They simply return a SafeBuffer containing the content as is. Instead, use safe_join to join content and escape it and concat to concatenate content and escape it, ensuring its safety.

    Example:

    user_content = "hi"
    
    # bad
    "

    #{user_content}

    ".html_safe # => ActiveSupport::SafeBuffer "

    hi

    " # good content_tag(:p, user_content) # => ActiveSupport::SafeBuffer "

    <b>hi</b>

    " # bad out = "" out << "
  • #{user_content}
  • " out << "
  • #{user_content}
  • " out.html_safe # => ActiveSupport::SafeBuffer "
  • hi
  • hi
  • " # good out = [] out << content_tag(:li, user_content) out << content_tag(:li, user_content) safe_join(out) # => ActiveSupport::SafeBuffer # "
  • <b>hi</b>
  • <b>hi</b>
  • " # bad out = "

    trusted content

    ".html_safe out.safe_concat(user_content) # => ActiveSupport::SafeBuffer "

    trusted_content

    hi" # good out = "

    trusted content

    ".html_safe out.concat(user_content) # => ActiveSupport::SafeBuffer # "

    trusted_content

    <b>hi</b>" # safe, though maybe not good style out = "trusted content" result = out.concat(user_content) # => String "trusted contenthi" # because when rendered in ERB the String will be escaped: # <%= result %> # => trusted content<b>hi</b> # bad (user_content + " " + content_tag(:span, user_content)).html_safe # => ActiveSupport::SafeBuffer "hi <span><b>hi</b></span>" # good safe_join([user_content, " ", content_tag(:span, user_content)]) # => ActiveSupport::SafeBuffer # "<b>hi</b> <span>&lt;b&gt;hi&lt;/b&gt;</span>"

    Tagging a string as html safe may be a security risk.
    Open

        body.html_safe

    This cop checks for the use of output safety calls like html_safe, raw, and safe_concat. These methods do not escape content. They simply return a SafeBuffer containing the content as is. Instead, use safe_join to join content and escape it and concat to concatenate content and escape it, ensuring its safety.

    Example:

    user_content = "hi"
    
    # bad
    "

    #{user_content}

    ".html_safe # => ActiveSupport::SafeBuffer "

    hi

    " # good content_tag(:p, user_content) # => ActiveSupport::SafeBuffer "

    <b>hi</b>

    " # bad out = "" out << "
  • #{user_content}
  • " out << "
  • #{user_content}
  • " out.html_safe # => ActiveSupport::SafeBuffer "
  • hi
  • hi
  • " # good out = [] out << content_tag(:li, user_content) out << content_tag(:li, user_content) safe_join(out) # => ActiveSupport::SafeBuffer # "
  • <b>hi</b>
  • <b>hi</b>
  • " # bad out = "

    trusted content

    ".html_safe out.safe_concat(user_content) # => ActiveSupport::SafeBuffer "

    trusted_content

    hi" # good out = "

    trusted content

    ".html_safe out.concat(user_content) # => ActiveSupport::SafeBuffer # "

    trusted_content

    <b>hi</b>" # safe, though maybe not good style out = "trusted content" result = out.concat(user_content) # => String "trusted contenthi" # because when rendered in ERB the String will be escaped: # <%= result %> # => trusted content<b>hi</b> # bad (user_content + " " + content_tag(:span, user_content)).html_safe # => ActiveSupport::SafeBuffer "hi <span><b>hi</b></span>" # good safe_join([user_content, " ", content_tag(:span, user_content)]) # => ActiveSupport::SafeBuffer # "<b>hi</b> <span>&lt;b&gt;hi&lt;/b&gt;</span>"

    Tagging a string as html safe may be a security risk.
    Open

            body << '=== ' + (full_original_taxon_name_tag(i) + "\n").html_safe

    This cop checks for the use of output safety calls like html_safe, raw, and safe_concat. These methods do not escape content. They simply return a SafeBuffer containing the content as is. Instead, use safe_join to join content and escape it and concat to concatenate content and escape it, ensuring its safety.

    Example:

    user_content = "hi"
    
    # bad
    "

    #{user_content}

    ".html_safe # => ActiveSupport::SafeBuffer "

    hi

    " # good content_tag(:p, user_content) # => ActiveSupport::SafeBuffer "

    <b>hi</b>

    " # bad out = "" out << "
  • #{user_content}
  • " out << "
  • #{user_content}
  • " out.html_safe # => ActiveSupport::SafeBuffer "
  • hi
  • hi
  • " # good out = [] out << content_tag(:li, user_content) out << content_tag(:li, user_content) safe_join(out) # => ActiveSupport::SafeBuffer # "
  • <b>hi</b>
  • <b>hi</b>
  • " # bad out = "

    trusted content

    ".html_safe out.safe_concat(user_content) # => ActiveSupport::SafeBuffer "

    trusted_content

    hi" # good out = "

    trusted content

    ".html_safe out.concat(user_content) # => ActiveSupport::SafeBuffer # "

    trusted_content

    <b>hi</b>" # safe, though maybe not good style out = "trusted content" result = out.concat(user_content) # => String "trusted contenthi" # because when rendered in ERB the String will be escaped: # <%= result %> # => trusted content<b>hi</b> # bad (user_content + " " + content_tag(:span, user_content)).html_safe # => ActiveSupport::SafeBuffer "hi <span><b>hi</b></span>" # good safe_join([user_content, " ", content_tag(:span, user_content)]) # => ActiveSupport::SafeBuffer # "<b>hi</b> <span>&lt;b&gt;hi&lt;/b&gt;</span>"

    Tagging a string as html safe may be a security risk.
    Open

        ).html_safe +

    This cop checks for the use of output safety calls like html_safe, raw, and safe_concat. These methods do not escape content. They simply return a SafeBuffer containing the content as is. Instead, use safe_join to join content and escape it and concat to concatenate content and escape it, ensuring its safety.

    Example:

    user_content = "hi"
    
    # bad
    "

    #{user_content}

    ".html_safe # => ActiveSupport::SafeBuffer "

    hi

    " # good content_tag(:p, user_content) # => ActiveSupport::SafeBuffer "

    <b>hi</b>

    " # bad out = "" out << "
  • #{user_content}
  • " out << "
  • #{user_content}
  • " out.html_safe # => ActiveSupport::SafeBuffer "
  • hi
  • hi
  • " # good out = [] out << content_tag(:li, user_content) out << content_tag(:li, user_content) safe_join(out) # => ActiveSupport::SafeBuffer # "
  • <b>hi</b>
  • <b>hi</b>
  • " # bad out = "

    trusted content

    ".html_safe out.safe_concat(user_content) # => ActiveSupport::SafeBuffer "

    trusted_content

    hi" # good out = "

    trusted content

    ".html_safe out.concat(user_content) # => ActiveSupport::SafeBuffer # "

    trusted_content

    <b>hi</b>" # safe, though maybe not good style out = "trusted content" result = out.concat(user_content) # => String "trusted contenthi" # because when rendered in ERB the String will be escaped: # <%= result %> # => trusted content<b>hi</b> # bad (user_content + " " + content_tag(:span, user_content)).html_safe # => ActiveSupport::SafeBuffer "hi <span><b>hi</b></span>" # good safe_join([user_content, " ", content_tag(:span, user_content)]) # => ActiveSupport::SafeBuffer # "<b>hi</b> <span>&lt;b&gt;hi&lt;/b&gt;</span>"

    Tagging a string as html safe may be a security risk.
    Open

        ].compact.join.html_safe

    This cop checks for the use of output safety calls like html_safe, raw, and safe_concat. These methods do not escape content. They simply return a SafeBuffer containing the content as is. Instead, use safe_join to join content and escape it and concat to concatenate content and escape it, ensuring its safety.

    Example:

    user_content = "hi"
    
    # bad
    "

    #{user_content}

    ".html_safe # => ActiveSupport::SafeBuffer "

    hi

    " # good content_tag(:p, user_content) # => ActiveSupport::SafeBuffer "

    <b>hi</b>

    " # bad out = "" out << "
  • #{user_content}
  • " out << "
  • #{user_content}
  • " out.html_safe # => ActiveSupport::SafeBuffer "
  • hi
  • hi
  • " # good out = [] out << content_tag(:li, user_content) out << content_tag(:li, user_content) safe_join(out) # => ActiveSupport::SafeBuffer # "
  • <b>hi</b>
  • <b>hi</b>
  • " # bad out = "

    trusted content

    ".html_safe out.safe_concat(user_content) # => ActiveSupport::SafeBuffer "

    trusted_content

    hi" # good out = "

    trusted content

    ".html_safe out.concat(user_content) # => ActiveSupport::SafeBuffer # "

    trusted_content

    <b>hi</b>" # safe, though maybe not good style out = "trusted content" result = out.concat(user_content) # => String "trusted contenthi" # because when rendered in ERB the String will be escaped: # <%= result %> # => trusted content<b>hi</b> # bad (user_content + " " + content_tag(:span, user_content)).html_safe # => ActiveSupport::SafeBuffer "hi <span><b>hi</b></span>" # good safe_join([user_content, " ", content_tag(:span, user_content)]) # => ActiveSupport::SafeBuffer # "<b>hi</b> <span>&lt;b&gt;hi&lt;/b&gt;</span>"

    TODO found
    Open

      # TODO: rename reference_taxon_name

    TODO found
    Open

      # # TODO: rename reference_taxon_name

    TODO found
    Open

      # TODO: always displayed inline, consider target

    TODO found
    Open

      # TODO: Add depth, Markdown

    TODO found
    Open

    # Part 2 TODO (post first pass)

    TODO found
    Open

          a = history_author_year_tag(t)   # TODO: probably label

    TODO found
    Open

    # Part 1 TODO:

    TODO found
    Open

          # history_type_material(i), # TODO: could still be OK here

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

      def paper_history_author_year_tag(taxon_name)
        return nil if taxon_name.nil? || taxon_name.cached_author_year.nil?
    
        body =  case taxon_name.type
                when 'Combination'
    Severity: Minor
    Found in app/helpers/taxon_names/paper_catalog_helper.rb and 1 other location - About 15 mins to fix
    app/helpers/taxon_names/catalog_helper.rb on lines 99..108

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

    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

    There are no issues that match your filters.

    Category
    Status