Showing 8 of 25 total issues
Method play
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def play(challenge)
begin
challenge.start
VimGolf.ui.warn "Launching VimGolf session for challenge: #{challenge.id}"
# -Z - restricted mode, utilities not allowed
- 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 play
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def play(challenge)
begin
challenge.start
VimGolf.ui.warn "Launching VimGolf session for challenge: #{challenge.id}"
# -Z - restricted mode, utilities not allowed
Method print_envs
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def print_envs(apps, default_env_name = nil, simple = false)
if simple
envs = apps.map{ |a| a.environments }
envs.flatten.map{|x| x.name}.uniq.each do |env|
puts env
- 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 each
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def each
scanner = StringScanner.new(@input)
# A Vim keycode is either a single byte, or a 3-byte sequence starting
# with 0x80.
- 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 download
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def download
@remote = true
begin
url = URI("#{GOLFHOST}/challenges/#{@id}.json")
res = Net::HTTP.start(
Method create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create
challenge = challenge_params
challenge[:diff] = challenge.delete(:diff).read rescue nil
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create
if params[:entry] && params[:entry].size < 2
@cheat = true
elsif params['challenge_id'] && !params['apikey'].empty? && !params['apikey'].nil?
- 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 debug
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def debug(name, message = nil)
return unless ENV["DEBUG"]
if message
message = message.inspect unless message.is_a?(String)
- 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"