psu-libraries/psulib_blacklight

View on GitHub

Showing 24 of 39 total issues

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

    def generate_links(search_type, options)
      result = []
      options[:value].zip(strict_titles(search_type, options)).each do |item, zipped|
        lnk = link_to(item,
                      "/?#{search_query(search_type)}=#{CGI.escape(zipped || item)}",
Severity: Minor
Found in app/helpers/search_links_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 limit_clause_count has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def limit_clause_count(solr_parameters)
    return unless query_present?(solr_parameters)

    length = case blacklight_params['search_field']
             when 'all_fields'
Severity: Minor
Found in app/models/clause_count_limiter.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 to_email_text has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def to_email_text
    semantics = to_semantic_values
    body = []
    ['title', 'latin_title', 'author', 'corporate_author', 'conference_author',
     'published', 'edition', 'format', 'language'].each do |field|
Severity: Minor
Found in app/models/concerns/blacklight/document/email.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 pivot_facet_child_in_params? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def pivot_facet_child_in_params?(field_name, item, pivot_in_params = false)
    pivot_in_params = true if pivot_facet_in_params?(field_name, item)
    if item.items.present?
      item.items.each do |pivot_item|
        pivot_in_params = true if pivot_facet_child_in_params?(pivot_item.field, pivot_item)
Severity: Minor
Found in app/helpers/facets_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