oneclickorgs/one-click-orgs

View on GitHub

Showing 65 of 108 total issues

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

  def load_analytics_events_from_session
    return unless Rails.env.production? && OneClickOrgs::GoogleAnalytics.active?
    unless session[:analytics_events].blank?
      @analytics_events ||= []
      session[:analytics_events].dup.each do |event|
Severity: Minor
Found in app/controllers/application_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 can_propose? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def can_propose?
    result = true

    result &&= members.active.count >= 3
    result &&= directors.count >= 3
Severity: Minor
Found in app/models/coop.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 send_notification_email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def send_notification_email(proposal)
    notification_email_action = if proposal.respond_to?(:notification_email_action)
      proposal.notification_email_action
    else
      :notify_creation
Severity: Minor
Found in app/observers/proposal_mailer_observer.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 set_organisation_types has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def set_organisation_types
    if params[:association] == '1'
      Setting[:association_enabled] = 'true'
    else
      Setting[:association_enabled] = 'false'
Severity: Minor
Found in app/controllers/setup_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 draft= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def draft=(new_draft)
    # TODO Refactor this and #draft and #draft? to use #cast_to_boolean
    if new_draft == 'true'
      new_draft = true
    elsif new_draft == 'false'
Severity: Minor
Found in app/models/resolution.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