unepwcmc/SAPI

View on GitHub
app/services/checklist/pdf/history_content.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method listed_taxa has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def listed_taxa(tex, listed_taxa_ary, kingdom_name = 'FAUNA')
    tex << "\\listingtable#{kingdom_name.downcase}{"
    rows = []
    listed_taxa_ary.each do |tc|
      listed_taxon_name = listed_taxon_name(tc)
Severity: Minor
Found in app/services/checklist/pdf/history_content.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 kingdom has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def kingdom(tex, fetcher, kingdom_name)
    kingdom = fetcher.next
    return if kingdom.empty?
    @skip_ancestor_ids = nil

Severity: Minor
Found in app/services/checklist/pdf/history_content.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 kingdom has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def kingdom(tex, fetcher, kingdom_name)
    kingdom = fetcher.next
    return if kingdom.empty?
    @skip_ancestor_ids = nil

Severity: Minor
Found in app/services/checklist/pdf/history_content.rb - About 1 hr to fix

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

      def listing_with_change_type(listing_change)
        appendix =
          if listing_change.change_type_name == ChangeType::DELETION
            nil
          else
    Severity: Minor
    Found in app/services/checklist/pdf/history_content.rb - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    There are no issues that match your filters.

    Category
    Status