SpeciesFileGroup/taxonworks

View on GitHub
app/controllers/tasks/accessions/quick/simple_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage

Use id.presence || @specimen.try(:taxon_determinations).try(:first).try(:otu_id) instead of if id.blank? @specimen.try(:taxon_determinations).try(:first).try(:otu_id) else id end.
Open

    if id.blank?
      @specimen.try(:taxon_determinations).try(:first).try(:otu_id)
    else
      id
    end

This cop checks code that can be written more easily using Object#presence defined by Active Support.

Example:

# bad
a.present? ? a : nil

# bad
!a.present? ? nil : a

# bad
a.blank? ? nil : a

# bad
!a.blank? ? a : nil

# good
a.presence

Example:

# bad
a.present? ? a : b

# bad
!a.present? ? b : a

# bad
a.blank? ? b : a

# bad
!a.blank? ? a : b

# good
a.presence || b

TODO found
Open

  # TODO: move this to model!

There are no issues that match your filters.

Category
Status