historyforge/historyforge

View on GitHub

Showing 131 of 347 total issues

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

  def matches?(record)
    needed_matches = [record.to_prefix, record.to_name, record.to_suffix, record.to_city].select(&:present?).size
    matches = 0
    matches += 1 if record.to_prefix.present? && address.street_prefix == record.to_prefix
    matches += 1 if record.to_name.present? && address.street_name == record.to_name
Severity: Minor
Found in app/services/reverse_street_conversion.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 disable_and_reset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def disable_and_reset
    @user = User.find(params[:id])
    if @user.provider?
      flash[:error] = 'Sorry, users from other providers are not able to be reset'
      return redirect_to action: 'show'
Severity: Minor
Found in app/controllers/users_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 items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def items
      @items || begin
        @items = model.items.map { |item|
          item.theme_callback ||= :menu_list_item
          item.active_callback ||= :current_page?
Severity: Minor
Found in app/services/cms/menu_presenter.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 translate_income has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def translate_income
    return if wages_or_salary.present? || income.blank?

    self.wages_or_salary = if income == 999
      'Un'
Severity: Minor
Found in app/models/census1940_record.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def render
    if style.present?
      if style == 'raw'
        RawImgTagRenderer.new(self).render
      elsif style == 'parallax'
Severity: Minor
Found in app/models/cms/picture.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 with_extra_items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def with_extra_items(items)
    keys = items.map(&:last)
    items.unshift ['Left blank', nil]
    other_item = ['{{OTHER}}', (keys.include?(value) || value.blank? ? 'other' : value)]
    if options[:other_index]
Severity: Minor
Found in app/inputs/radio_buttons_other_input.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

Function getFieldConfigFromScope has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    getFieldConfigFromScope(scope: string): AttributeFilterConfig {
        for (let attribute in this.attributeFilters) {
            const value = this.attributeFilters[attribute];
            if ((value.scopes != null ? value.scopes[scope] : void 0) != null) {
                return value;
Severity: Minor
Found in app/javascript/search/AdvancedSearch.ts - 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 column_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def column_config(column)
    options = {
      headerName: Translator.label(Building, column),
      field: column,
      resizable: true
Severity: Minor
Found in app/services/building_grid_translator.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

Function getBuildingList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function getBuildingList() {
  let house = $('#census_record_street_house_number').val()
  if (house === '') house = null
  let locality_id = jQuery('#census_record_locality_id').val()
  let street = jQuery('#street_name').val()
Severity: Minor
Found in app/javascript/application.js - 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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def render
      html_options = { class: 'cms-slide cms-embed ' }
      html_options[:class] << embed.css_class if embed.css_class?
      html_options[:id] = embed.css_id if embed.css_id
      html_options[:style] = 'padding-top:56.2%;width:100%;position:relative;'
Severity: Minor
Found in app/models/cms/embed.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def render

      html = content_tag :source, '', { src: audio.url }
      html = content_tag :audio, html, { controls: 'controls' }

Severity: Minor
Found in app/models/cms/audio.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