SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,634 of 12,634 total issues

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

    def history_author_year(taxon_name, citation)
      return content_tag(:span, 'Source is verbatim, requires parsing', class: 'feedback feedback-thin feedback-warning') if citation.try(:source).try(:type) == 'Source::Verbatim'
      str =  history_author_year_tag(taxon_name)
      return nil if str.blank?
      if citation
Severity: Minor
Found in app/helpers/taxon_names/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 collecting_event_identifiers_tag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def collecting_event_identifiers_tag(collecting_event)
    return nil if collecting_event.nil?
    if i = collecting_event.identifiers.load.first
      collecting_event.identifiers.limit(10).collect{|j|
        content_tag(:span, j.cached, class: [ :feedback, 'feedback-thin', 'feedback-secondary' ])
Severity: Minor
Found in app/helpers/collecting_events_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 create_primers_batch_load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_primers_batch_load
    if params[:file] && digested_cookie_exists?(params[:file].tempfile, :Primers_sequences_md5)
      @result = BatchLoad::Import::Sequences::PrimersInterpreter.new(**batch_params)
      if @result.create
        flash[:notice] = "Successfully proccessed file, #{@result.total_records_created} sequences were created."
Severity: Minor
Found in app/controllers/sequences_controller.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_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 distribution has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def distribution
    respond_to do |format|
      format.json do
        @cached_map_type = params[:cached_map_type] || 'CachedMapItem::WebLevel1'
        @quicker_cached_map = @otu.quicker_cached_map(@cached_map_type)
Severity: Minor
Found in app/controllers/otus_controller.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    next_sqed_depiction = @sqed_depiction

    if @sqed_depiction.depiction.depiction_object.update(collection_object_params)
      flash[:notice] = 'Successfully updated'
Severity: Minor
Found in app/controllers/tasks/accessions/breakdown/sqed_depiction_controller.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 repository_usage_tag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def repository_usage_tag(repository)
    total_in_project = repository.collection_objects.where(collection_objects: {project_id: sessions_current_project_id}).count 
    total_current_in_project = repository.current_collection_objects.where(collection_objects: {project_id: sessions_current_project_id}).count

    total = (repository.respond_to?(:use_count) ? repository.use_count : repository.collection_objects.count)  
Severity: Minor
Found in app/helpers/repositories_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 create_qualitative_descriptor_batch_load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_qualitative_descriptor_batch_load
    if params[:file] && digested_cookie_exists?(
        params[:file].tempfile,
        :qualitative_descriptors_batch_load_md5)
      @result = BatchLoad::Import::Descriptors::QualitativeInterpreter.new(**batch_params)
Severity: Minor
Found in app/controllers/descriptors_controller.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 batch_data_created_td has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def batch_data_created_td(rp)
    content_tag :td do
      content_tag :table do
        rp.objects.collect { |klass, objs|
          content_tag(:tr, content_tag(:td, klass), class: 'underlined_elements') +
Severity: Minor
Found in app/helpers/batch_load/batch_load_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 source_tag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def source_tag(source)
    return nil if source.nil?
    # TODO: sanitize should happen at the model validation level, not here!
    source.cached ? sanitize(source.cached, tags: ['i']).html_safe : (source.new_record? ? nil : 'ERROR - Source cache not set, please notify admin.')
  end
Severity: Minor
Found in app/helpers/sources_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 lat_long_source has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def lat_long_source
    if preferred_georeference
      :georeference
    elsif verbatim_latitude && verbatim_longitude
      :verbatim
Severity: Minor
Found in app/models/collecting_event/geo_locate.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 create_gpx_batch_load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_gpx_batch_load
    if params[:file] && digested_cookie_exists?(params[:file].tempfile, :gpx_batch_load_collecting_events_md5)
      @result = BatchLoad::Import::CollectingEvents::GPXInterpreter.new(**batch_params)
      if @result.create
        flash[:notice] = "Successfully proccessed file, #{@result.total_records_created} collecting events w/georeferences were created."
Severity: Minor
Found in app/controllers/collecting_events_controller.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    user = User.find_by(email: params[:session][:email].downcase)
    if user && user.authenticate(params[:session][:password]) 
      
      unless user.is_flagged_for_password_reset?
Severity: Minor
Found in app/controllers/sessions_controller.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 metadata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def metadata
    @object = GlobalID::Locator.locate(params.require(:global_id))
    render(json: { success: false}, status: :not_found) if @object.nil?
    render(json: { 'message' => 'Record not found' }, status: :unauthorized) and return  if !@object.is_community? && @object.project_id != sessions_current_project_id
    render(json: { 'message' => "#{@object.class} is not configured for THE GRAPH"}, status: :method_not_allowed) and return unless @object.class.const_defined?('GRAPH_ENTRY_POINTS') 
Severity: Minor
Found in app/controllers/graph_controller.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 create_simple_batch_load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_simple_batch_load
    if params[:file] && digested_cookie_exists?(params[:file].tempfile, :simple_taxon_names_md5)
      @result =  BatchLoad::Import::TaxonifiToTaxonworks.new(**batch_params)
      if @result.create
        flash[:notice] = "Successfully proccessed file, #{@result.total_records_created} taxon names were created."
Severity: Minor
Found in app/controllers/taxon_names_controller.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 type_material_collecting_event_label has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def type_material_collecting_event_label(collecting_event, verbose = false)
    missing = '[TODO: A document (preferred) or verbatim label in a collecting event must be provided]'
    if ce = collecting_event
      if ce.document_label
        return ::Utilities::Strings.linearize(ce.document_label)
Severity: Minor
Found in app/helpers/type_materials/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 create_nomen_batch_load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_nomen_batch_load
    if params[:file] && digested_cookie_exists?(params[:file].tempfile, :nomen_taxon_names_md5)
      @result = BatchLoad::Import::TaxonNames::NomenInterpreter.new(**batch_params)
      if @result.create
        flash[:notice] = "Successfully proccessed file, #{@result.total_records_created} items were created."
Severity: Minor
Found in app/controllers/taxon_names_controller.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 text_row has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def text_row(row)
    color  = 'green'
    color  = 'red' unless row[:err].blank?
    output = "<li class=#{color}>"
    output += (row[:row].to_s)
Severity: Minor
Found in app/helpers/tasks/import/dwca/psu_import_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 image_short_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def image_short_url(image, api: true)
    if !image.kind_of?(::Image) && (Integer(image) rescue false)
      image = ::Image.find(image)
    end

Severity: Minor
Found in app/helpers/images_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

Severity
Category
Status
Source
Language