Showing 29 of 31 total issues
Method upload
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def upload type, resource, id, payload, file
Avoid too many return
statements within this method. Open
return prepare(node.content.to_s)
Avoid too many return
statements within this method. Open
return result_hash
Avoid too many return
statements within this method. Open
return result_hash
Method validate!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate!
raise ArgumentError, 'id lang must be number' unless id_lang.kind_of?(Integer)
raise ArgumentError, 'name must string' unless name.kind_of?(String)
raise ArgumentError, 'group_type must string' unless group_type.kind_of?(String)
end
- 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 reference
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def reference
if @reference and not @reference.to_s.empty?
@reference.to_s.length > 32 ? Digest::MD5.hexdigest(@reference) : @reference
else
Digest::MD5.hexdigest(name)
- 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 api_url=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def api_url= origin_url
url = origin_url.match(/^(http|https):\/\/.*/)
url = url.nil? ? 'http://' + origin_url : url.to_s
url << '/' unless url.end_with? '/'
url << 'api/' unless url.end_with? 'api/'
- 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_from_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_from_hash resources, id_lang
resources = [resources] if resources.kind_of?(Hash)
if resources.kind_of?(Array)
features = []
resources.each do |resource|
- 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 validate!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate!
raise ArgumentError, 'id lang must be number' unless id_lang.kind_of?(Integer)
raise ArgumentError, 'active must be number' unless active.kind_of?(Integer)
raise ArgumentError, 'name must string' unless name.kind_of?(String)
end
- 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"