Xzanth/pugbot

View on GitHub

Showing 6 of 27 total issues

Class BotPlugin has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

  class BotPlugin
    # Set up variables, called when the bot first connects to irc. Start an
    # array of names to not pmsg back.
    # @return [void]
    def initialize(*args)
Severity: Minor
Found in lib/pugbot/handlers.rb - About 3 hrs to fix

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

        def finish(m, arg1, arg2)
          user = m.user
          if arg1.nil?
            game = @queue_list.find_game_playing(m.user)
            return user.notice FINISH_NOT_INGAME if game.nil?
    Severity: Minor
    Found in lib/pugbot/handlers.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 remove has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def remove(m, name, arg)
          queue = @queue_list.find_queue_by_arg(arg)
          user = User(name)
          return m.user.notice ACCESS_DENIED unless m.channel.opped?(m.user)
          return m.user.notice USERS_NOT_FOUND if user.nil?
    Severity: Minor
    Found in lib/pugbot/handlers.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

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

        def del(m, arg)
          queue = @queue_list.find_queue_by_arg(arg)
          user = m.user
          return user.notice YOU_ARE_PLAYING if playing?(user)
          return del_from_all(m, user) if arg.nil? || arg == "all"
    Severity: Minor
    Found in lib/pugbot/handlers.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

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

        def from_hash(hash)
          @queues = []
          hash.each do |q|
            queue = new_queue(q["queue_name"], q["max_players"])
            q["players"].each do |p|
    Severity: Minor
    Found in lib/pugbot/queue_list.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

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

        def add(m, arg)
          queue = @queue_list.find_queue_by_arg(arg)
          user = m.user
          if /.+otenet.gr/ =~ user.host
            @xtremecount += 1
    Severity: Minor
    Found in lib/pugbot/handlers.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