Showing 7 of 11 total issues
Method get_uris_by_rel
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def get_uris_by_rel(uri, rel, params = {})
begin
uri = URI.parse(uri.to_s) unless uri.respond_to?('open')
Discodactyl.log.debug "Getting uris for uri #{uri.inspect} by rel #{rel.inspect} with params #{params.inspect}" if Discodactyl.log
resource = uri.open
- 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 hcard_from_uri
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def self.hcard_from_uri(uri, io)
begin
Discodactyl.log.debug("hCard lookup for #{uri}") if Discodactyl.log
if hcards = Prism.find(uri, :hcard)
hcards.each do |hcard|
- 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_uris_by_rel
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_uris_by_rel(uri, rel, params = {})
begin
uri = URI.parse(uri.to_s) unless uri.respond_to?('open')
Discodactyl.log.debug "Getting uris for uri #{uri.inspect} by rel #{rel.inspect} with params #{params.inspect}" if Discodactyl.log
resource = uri.open
Method parse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def parse(string)
LinkHeader.new.tap do |params|
if string =~ /^<([^>]+)>(.*)$/
params[:href] = $1
$2.split(/;\s*/).each do |part|
- 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 for_rel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.for_rel(rel)
case rel
when 'http://microformats.org/profile/hcard' then
lambda {|uri, io| Discodactyl::CLI::Format.hcard_from_uri(uri, io) }
when 'http://schemas.google.com/g/2010#updates-from' then
- 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 ==
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ==(other)
return false unless other.class == self.class
return false unless other.instance_variables == self.instance_variables
self.instance_variables.each do |var|
self_var = self.instance_variable_get(var)
- 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 activities_from_uri
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.activities_from_uri(uri, io)
Discodactyl.log.debug("Activity feed lookup for #{uri}") if Discodactyl.log
begin
if uri && (feed = Feedzirra::Feed.fetch_and_parse(uri)) && feed.respond_to?(:entries)
Array(feed.entries).each do |entry|
- 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"