app/controllers/application_controller.rb
Class has too many lines. [136/100] Open
Open
class ApplicationController < ActionController::Base
protect_from_forgery
before_action :store_location,
:assign_footer_page_links,
:set_tags,
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class ApplicationController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ApplicationController < ActionController::Base
protect_from_forgery
before_action :store_location,
:assign_footer_page_links,
:set_tags,
Assignment Branch Condition size for after_sign_in_path_for is too high. [19.42/15] (http://c2.com/cgi/wiki?AbcMetric) Open
Open
def after_sign_in_path_for(resource)
set_flash_warning_reminder_to_update_details resource
return edit_user_path id: current_user.id if session[:pending_organisation_id]
return organisation_path(current_user.organisation) if current_user.organisation
return session[:previous_url] if session[:previous_url]
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Use attr_reader
to define trivial reader methods. (https://github.com/bbatsov/ruby-style-guide#attr_family) Open
Open
def iframe
- Read upRead up
- Exclude checks
This cop looks for trivial reader/writer methods, that could have been created with the attr_* family of functions automatically.
Example:
# bad
def foo
@foo
end
def bar=(val)
@bar = val
end
def self.baz
@baz
end
# good
attr_reader :foo
attr_writer :bar
class << self
attr_reader :baz
end
Line is too long. [95/90] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
Open
@map_zoom_level = @iframe.blank? ? Setting.map_zoom_level : Setting.embedded_map_zoom_level
- Exclude checks
Do not prefix writer method names with set_
. (https://github.com/bbatsov/ruby-style-guide#accessor_mutator_method_names) Open
Open
def set_flash_warning_reminder_to_update_details usr
- Read upRead up
- Exclude checks
This cop makes sure that accessor methods are named properly.
Example:
# bad
def set_attribute(value)
end
# good
def attribute=(value)
end
# bad
def get_attribute
end
# good
def attribute
end