scottwillson/racing_on_rails

View on GitHub

Showing 333 of 1,278 total issues

Method destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def destroy
      @event = Event.find(params[:id])
      if @event.destroy
        expire_cache
        respond_to do |format|
Severity: Minor
Found in app/controllers/admin/events_controller.rb - About 35 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 age_category has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def age_category
      if female?
        if junior?
          "girl"
        else
Severity: Minor
Found in app/models/people/ages.rb - About 35 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 th has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def th(attribute = nil, *options)
    _attribute = nil
    _attribute = attribute.to_s if attribute

    locals = { attribute: _attribute }
Severity: Minor
Found in app/helpers/table_helper.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.render(column, row)
        result = row.source
        text = row[column.key]
        return text unless result.person_id

Severity: Minor
Found in app/helpers/results/renderers/name_renderer.rb - About 35 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 <=> has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def <=>(other)
    return -1 if other.nil?
    return super unless other.is_a?(Category)
    return 0 if self[:id] && self[:id] == other[:id]

Severity: Minor
Found in app/models/category.rb - About 35 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 [] has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.[](name)
    return nil unless name

    load_aliases if @@all_aliases.nil?
    if name.is_a?(Symbol)
Severity: Minor
Found in app/models/discipline.rb - About 35 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 resolve_duplicates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def resolve_duplicates
        @duplicates = Duplicate.all
        @duplicates.each do |duplicate|
          id = params[duplicate.to_param]
          if id == "new"
Severity: Minor
Found in app/controllers/admin/people/import.rb - About 35 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 ages= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def ages=(value)
      case value
      when Range
        self.ages_begin = value.begin
        self.ages_end = value.end
Severity: Minor
Found in app/models/categories/ages.rb - About 35 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 assign_new_event has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def assign_new_event
      if params[:event].nil?
        @event = SingleDayEvent.new
        return true
      end
Severity: Minor
Found in app/controllers/admin/events_controller.rb - About 35 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 find_all_for_export has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.find_all_for_export(date = Time.zone.today, include_people = "members_only")
        association_number_issuer_id = NumberIssuer.find_by(name: RacingAssociation.current.short_name).id
        case include_people
        when "members_only"
          where_clause = "WHERE (people.member_to >= '#{date}')"
Severity: Minor
Found in app/models/people/export.rb - About 35 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 fill_in_editor_field has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def fill_in_editor_field(with:, currently_with: nil, fill_options: {}, **find_options)
    retries = 0
    3.times do
      assert_selector "form.editor_field"
      within "form.editor_field" do
Severity: Minor
Found in test/system/actions.rb - About 35 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_page has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def render_page(path = nil)
    unless path
      path = controller_path
      path = "#{path}/#{action_name}" unless action_name == "index"
    end
Severity: Minor
Found in app/controllers/application_controller.rb - About 35 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

Avoid too many return statements within this method.
Open

      return "" if name.include?("N/A")
Severity: Major
Found in app/models/results/cleanup.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return true if RacingAssociation.current.rental_numbers.include?(numeric_value)
    Severity: Major
    Found in app/models/race_number.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return id <=> other.id unless new_record? || other.new_record?
      Severity: Major
      Found in app/models/events/comparison.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return event if diff < 5 && similar_dates?(event)
        Severity: Major
        Found in app/models/events/previous.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return numeric_place <=> other.numeric_place
          Severity: Major
          Found in app/models/results/comparison.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return id <=> other.id
            Severity: Major
            Found in app/models/results/comparison.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return nil if candidate_categories.empty?
              Severity: Major
              Found in app/models/categories/matching.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return nil if candidate_categories.empty?
                Severity: Major
                Found in app/models/categories/matching.rb - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language