Method update
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def update
# scrub out this crap when nothing submitted in ckeditor -- <p>Â </p>\r\n (see http://dev.ckeditor.com/ticket/9732)
params[:admin_challenge][:description] = nil if params[:admin_challenge][:description].include?('Â ')
params[:admin_challenge][:requirements] = nil if params[:admin_challenge][:requirements].include?('Â ')
- 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 create
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
data = {}
data[:name] = params[:name]
data[:description] = '<p>Your
Method update
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
# scrub out this crap when nothing submitted in ckeditor -- <p>Â </p>\r\n (see http://dev.ckeditor.com/ticket/9732)
params[:admin_challenge][:description] = nil if params[:admin_challenge][:description].include?('Â ')
params[:admin_challenge][:requirements] = nil if params[:admin_challenge][:requirements].include?('Â ')
Method check_for_appirio_task
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_for_appirio_task
if params[:task]
cmc_client = Restforce.new :username => ENV['CMC_USERNAME'],
:password => ENV['CMC_PASSWORD'],
- 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 edit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def edit
# move the existing assets to a new array
@current_assets = @challenge.assets || []
# this array will only contain new assets being uploaded
- 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"