linyows/stalkerr

View on GitHub
lib/stalkerr/target/github.rb

Summary

Maintainability
D
2 days
Test Coverage

Method parse has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    def parse(event)
      obj = event.payload
      repository = event.repo.name

      status = title = link = ''
Severity: Minor
Found in lib/stalkerr/target/github.rb - About 1 day 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 parse has 149 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def parse(event)
      obj = event.payload
      repository = event.repo.name

      status = title = link = ''
Severity: Major
Found in lib/stalkerr/target/github.rb - About 5 hrs to fix

    Method posts has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def posts(p)
          header = ''
          header = "(#{p[:repository]}) #{p[:status]}" unless p[:repository].eql? ''
          header = "#{header} #{p[:title]}" unless p[:title].eql? ''
          header = "#{header} - #{shorten(p[:link]).to_irc_color.blue}" unless p[:link].eql? ''
    Severity: Minor
    Found in lib/stalkerr/target/github.rb - About 1 hr 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 stalking has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def stalking(&post)
          @post = post
          client.received_events(@username).sort_by(&:id).reverse_each { |event|
            if @last_event_id.nil?
              time = Time.now - Stalkerr::Const::ROLLBACK_SEC
    Severity: Minor
    Found in lib/stalkerr/target/github.rb - About 1 hr 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