lib/apipie/dsl_definition.rb
Method _apipie_define_validators
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
Open
def _apipie_define_validators(description)
# [re]define method only if validation is turned on
if description && (Apipie.configuration.validate == true ||
Apipie.configuration.validate == :implicitly ||
- 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
File dsl_definition.rb
has 383 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Apipie
# DSL is a module that provides #api, #error, #param, #returns.
module DSL
Method returns
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
def returns(pgroup_or_options, desc_or_options = nil, options = {}, &block) #:doc:
return unless Apipie.active_dsl?
if desc_or_options.is_a? Hash
- 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 _apipie_define_validators
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def _apipie_define_validators(description)
# [re]define method only if validation is turned on
if description && (Apipie.configuration.validate == true ||
Apipie.configuration.validate == :implicitly ||
Method returns
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def returns(pgroup_or_options, desc_or_options = nil, options = {}, &block) #:doc:
return unless Apipie.active_dsl?
if desc_or_options.is_a? Hash
Method property
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def property(param_name, validator, desc_or_options = nil, options = {}, &block) #:doc:
Method param
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def param(param_name, validator, desc_or_options = nil, options = {}, &block) #:doc: