Method index
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def index
params[:version] ||= Apipie.configuration.default_version
get_format
- 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 index
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
params[:version] ||= Apipie.configuration.default_version
get_format
Method get_language
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_language
return nil unless Apipie.configuration.translate
lang = Apipie.configuration.default_locale
[:resource, :method, :version].each do |par|
next unless params[par]
- 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 get_format
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_format
[:resource, :method, :version].each do |par|
next unless params[par]
[:html, :json].each do |format|
extension = ".#{format}"
- 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 render_from_cache
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_from_cache
path = Apipie.configuration.doc_base_url.dup
path << "/" << params[:version] if params[:version].present?
path << "/" << params[:resource] if params[:resource].present?
path << "/" << params[:method] if params[:method].present?
- 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"