josephholsten/discodactyl

View on GitHub
lib/discodactyl/cli/format.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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|
Severity: Minor
Found in lib/discodactyl/cli/format.rb - About 3 hrs to fix

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
Severity: Minor
Found in lib/discodactyl/cli/format.rb - About 45 mins to fix

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|
Severity: Minor
Found in lib/discodactyl/cli/format.rb - About 35 mins to fix

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

There are no issues that match your filters.

Category
Status