SpeciesFileGroup/taxonworks

View on GitHub
lib/export/coldp/files/name_relation.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

  def self.generate(otus, project_members, reference_csv = nil )
    ::CSV.generate(col_sep: "\t") do |csv|

      csv << %w{
        nameID

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 generate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.generate(otus, project_members, reference_csv = nil )
    ::CSV.generate(col_sep: "\t") do |csv|

      csv << %w{
        nameID
Severity: Minor
Found in lib/export/coldp/files/name_relation.rb - About 1 hr to fix

    Method generate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.generate(otus, project_members, reference_csv = nil )
        ::CSV.generate(col_sep: "\t") do |csv|
    
          csv << %w{
            nameID
    Severity: Minor
    Found in lib/export/coldp/files/name_relation.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

    TODO found
    Open

      # TODO: SupressedSynony misspelled in TW models, which probably should be SupressedSynonym

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

          type = "type"

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

        if tnr.type.include? "TaxonNameRelationship::Typification"  # There are no nomen_uri's for Typification

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    There are no issues that match your filters.

    Category
    Status