Showing 73 of 116 total issues
Method initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(hash = nil)
return if hash.nil?
@version = hash['version']
v = hash['methods']
@methods = if v
- 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 application_state
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def application_state(app, gear_groups = nil, deployments = nil)
deployments ||= load_deployments(app[:id])
gear_groups ||= load_gears(app[:id])
return :created if state_created?(app, gear_groups, deployments)
- 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_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def download_file(app_guid, file_path, headers_to_use = nil)
expected_statuses = [200, 302, 400, 404]
# Hack, do not create fresh headers (which would fail) when in a deferred action
headers_to_use ||= headers
- 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 matching_cartridges
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def matching_cartridges(cartridges, runtime)
partial_matches = []
matches = cartridges.find_all do |cartridge|
if cartridge[:type] != 'standalone'
false
- 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 state_deployed?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def state_deployed?(app, gear_groups, deployments)
# Gears must all be stopped
return false unless gear_groups[0][:gears].all? { |gear| gear[:state] == 'stopped' }
deployments ||= load_deployments(app[: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"
Further reading
Method execute_request
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def execute_request(method, default_expect, path, params, native_call = false)
params[:expects] = default_expect unless params.key? :expects
params[:method] = method
url = Regexp::PERFECT_URL_PATTERN =~ path ? path : to_url(path)
- 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
Avoid too many return
statements within this method. Open
return :idle if gear_groups[0][:gears].all? { |gear| gear[:state] == 'idle' }
Avoid too many return
statements within this method. Open
return Enums::ApplicationStates::IDLE if dynos_idle?(dynos)
Avoid too many return
statements within this function. Open
return this.renderer.listitem(body);
Avoid too many return
statements within this function. Open
return this.renderer.paragraph(this.parseText());
Avoid too many return
statements within this function. Open
return this.renderer.blockquote(body);
Avoid too many return
statements within this function. Open
return this.renderer.html(html);
Avoid too many return
statements within this function. Open
return '<p>An error occured:</p><pre>'
+ escape(e.message + '', true)
+ '</pre>';
Avoid too many return
statements within this function. Open
return Parser.parse(Lexer.lex(src, opt), opt);
Avoid too many return
statements within this function. Open
return this.renderer.table(header, body);
Avoid too many return
statements within this function. Open
return this.renderer.listitem(body);
Avoid too many return
statements within this function. Open
return this.renderer.list(body, ordered);
Avoid too many return
statements within this function. Open
return this.renderer.paragraph(this.inline.output(this.token.text));
Method call
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
auth = ::Rack::Auth::Basic::Request.new(env)
return unauthorized('No authentication header provided', env) unless auth.provided?
- 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 to_nucleus_app
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_nucleus_app(app_resource)
metadata = app_resource[:metadata]
app = app_resource[:entity]
app[:id] = metadata[:guid]
- 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"