linyows/octospy

View on GitHub

Showing 8 of 8 total issues

Method irc_bot has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def irc_bot
      Octokit.configure do |c|
        c.api_endpoint = Octospy.github_api_endpoint if Octospy.github_api_endpoint
        c.web_endpoint = Octospy.github_web_endpoint if Octospy.github_web_endpoint
        c.login        = Octospy.github_login
Severity: Minor
Found in lib/octospy.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 show_commands has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def show_commands(m)
        m.reply "#{m.bot.name}:"
        @handlers.each do |handler|
          pattern = handler.pattern.pattern
          command = case pattern.class.name
Severity: Minor
Found in lib/cinch/plugins/octospy.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 parse_follow_event has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_follow_event
        user = @event.payload.target

        title = user.login
        title = "#{title} (#{user.name})" if user.name && user.name != ''
Severity: Minor
Found in lib/octospy/parser/user.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 build has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def build(hash)
      header = "#{hash[:nick].to_s.colorize_for_irc.bold} #{colorize_to hash[:status]}"

      if hash[:repository] && !hash[:repository].empty?
        header = "(#{hash[:repository]}) #{header}"
Severity: Minor
Found in lib/octospy/parser.rb - About 1 hr to fix

    Method notify_recent_envets has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def notify_recent_envets
          events = repository_events
          return if events.count.zero?
    
          last_event = events.sort_by(&:id).last
    Severity: Minor
    Found in lib/octospy/worker.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 build has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def build(hash)
          header = "#{hash[:nick].to_s.colorize_for_irc.bold} #{colorize_to hash[:status]}"
    
          if hash[:repository] && !hash[:repository].empty?
            header = "(#{hash[:repository]}) #{header}"
    Severity: Minor
    Found in lib/octospy/parser.rb - About 55 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 repository_events has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def repository_events
          @repositories.each_with_object([]) do |repo, arr|
            break unless api_requestable?
    
            sleep Octospy.api_request_interval
    Severity: Minor
    Found in lib/octospy/worker.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

    Method unwatch_repositories has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def unwatch_repositories(m, owner)
              repos = ::Octospy::Recordable.channel(m.channel.name).repos.each_with_object([]) do |repo, obj|
                obj << repo if repo.to_s.split('/').first == owner
              end
    
    
    Severity: Minor
    Found in lib/cinch/plugins/octospy/recording.rb - About 25 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

    Severity
    Category
    Status
    Source
    Language