Class ApplicationController
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
# Run authorization on all actions
# check_authorization
protect_from_forgery
File application_controller.rb
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
BrowserSpecificiation = Struct.new(:browser, :version)
class NotAuthorizedRunError < StandardError; end
class ApplicationController < ActionController::Base
Method enable_js_logger
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def enable_js_logger
unless params[:logging].nil?
# Update session when logging param is provided (usually as GET param).
session[:logging] = params[:logging] == "true"
end
Method enable_js_logger
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def enable_js_logger
unless params[:logging].nil?
# Update session when logging param is provided (usually as GET param).
session[:logging] = params[:logging] == "true"
end
- Read upRead up
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 unauthorized_response_data
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def unauthorized_response_data(action, resource)
if current_user
user = session[:portal_username] || current_user.email
else
user = "Anonymous"
- Read upRead up
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_run_key
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_run_key(opts)
# Special case when collaborators_data_url is provided (usually as a GET param).
# New collaboration will be created and setup and call finally returns collaboration owner
if params[:collaborators_data_url]
cc = CreateCollaboration.new(params[:collaborators_data_url], current_user, @activity)
- Read upRead up
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_sequence
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_sequence
# First, respect the sequence ID in the request if one is provided
if params[:sequence_id]
@sequence = Sequence.find(params[:sequence_id])
- Read upRead up
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"