scottwillson/racing_on_rails

View on GitHub

Showing 331 of 1,265 total issues

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

    def show
      @event = OregonWomensPrestigeSeries.find_for_year(@year) || OregonWomensPrestigeSeries.new
      @team_event = OregonWomensPrestigeTeamSeries.find_for_year(@year) || OregonWomensPrestigeTeamSeries.new

      request.session_options[:skip] = true
Severity: Minor
Found in app/controllers/competitions/oregon_womens_prestige_series_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 calculate! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.calculate!(calculator)
          return calculator.event_categories unless calculator.rules.missing_result_penalty?

          calculator.source_results
                    .group_by(&:participant)
Severity: Minor
Found in app/models/calculations/v3/steps/add_missing_results_penalty.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 membership_dates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def membership_dates
      errors.add("member_from", "cannot be nil if member_to is not nil (#{member_to})") if member_to && !member_from

      errors.add("member_to", "cannot be nil if member_from is not nil (#{member_from})") if member_from && !member_to

Severity: Minor
Found in app/models/people/membership.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 validate! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def validate!
          raise(ArgumentError, "id must be a Numeric") if id && !id.is_a?(Numeric)
          raise(ArgumentError, "event_category is required") unless event_category
          raise(ArgumentError, "event_category must be an EventCategory, but was a #{event_category.class}") unless event_category.is_a?(EventCategory)
        end
Severity: Minor
Found in app/models/calculations/v3/models/source_result.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 split_camelcase has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.split_camelcase(name)
        return name if name.nil?

        unless name.downcase == name || name.upcase == name
          name = name.gsub(/([A-Z\d]+)([A-Z][a-z])/, '\1 \2')
Severity: Minor
Found in app/models/categories/name_normalization.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 labelled_check_box has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def labelled_check_box(method, text = nil, check_box_options = {})
      label_options = check_box_options.delete(:label) || {}
      if check_box_options[:editable] == false
        labelled_text method, @object.send(method) ? "Yes" : "No", text, check_box_options
      else
Severity: Minor
Found in app/helpers/racing_on_rails/form_builder.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 import has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def import
        case params[:commit]
        when "Cancel"
          session[:people_file_path] = nil
          redirect_to(action: "index")
Severity: Minor
Found in app/controllers/admin/people/import.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 require_same_person_or_administrator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def require_same_person_or_administrator
    return false unless require_current_person

    unless administrator? || (@person && current_person == @person)
      redirect_to unauthorized_path
Severity: Minor
Found in app/controllers/authorization.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 replace_roman_numeral_categories has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.replace_roman_numeral_categories(name)
        if name
          name = name.split.map do |token|
            case token
            when "I"
Severity: Minor
Found in app/models/categories/name_normalization.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 labelled_select has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def labelled_select(method, choices, options = {}, html_options = { class: "form-control" })
      label_options = options.delete(:label) || { class: "control-label col-sm-4" }
      text = label_options.delete(:text) if label_options
      if options[:editable] == false
        %(#{label(method, (text || method.to_s.titleize).to_s, label_options)} <div id="#{object_name}_#{method}">#{@object.send(method)}</div>).html_safe
Severity: Minor
Found in app/helpers/racing_on_rails/form_builder.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 events_for_api has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def events_for_api(year)
    name = params[:name].try(:strip)
    year = RacingAssociation.current.effective_year.to_i if year.blank?

    if name.present?
Severity: Minor
Found in app/controllers/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

Severity
Category
Status
Source
Language