mezis/appfab

View on GitHub

Showing 23 of 23 total issues

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

  def after_save(record)
    return unless record.account && record.account_id_changed?
    record.account.users.each do |account_user|
      next if account_user == record # don't get notified when I join
      Notification::NewUser.create!(recipient:account_user, subject:record)
Severity: Minor
Found in app/observers/notification/user_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_category_from_params_and_angle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def set_category_from_params_and_angle
    session[:ideas_category] ||= {}
    params[:category] =
    session[:ideas_category][@angle] = begin
      valid_categories = (current_user.account.andand.categories || []) + %w(all none)
Severity: Minor
Found in app/controllers/ideas_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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    idea = current_account.ideas.find(params[:user_bookmark][:idea_id])
    @user_bookmark = current_user.bookmarks.new(idea: idea)
    if @user_bookmark.save
      flash[:success] = _('Bookmark successfuly added.')
Severity: Minor
Found in app/controllers/user/bookmarks_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