iranzo/stampython

View on GitHub

Showing 97 of 154 total issues

Function sendmessage has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def sendmessage(chat_id=0, text="", reply_to_message_id=False,
Severity: Minor
Found in stampy/stampy.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if result['ok'] is True or result['ok'] == 'True':
                            text = _("User %s deoped on chat %s") % (user_id, chat_id)
                        else:
                            text = _("Error deoping %s from chat %s: %s") % (user_id, chat_id, result)
    
    
    Severity: Major
    Found in stampy/plugin/irccommands.py - About 45 mins to fix

      Function stock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def stock(message):
          """
          Processes stock commands
          :param message: Message with the command
          :return:
      Severity: Minor
      Found in stampy/plugin/stock.py - 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

      Avoid deeply nested control flow statements.
      Open

                          if cleankey:
                              renewurl = re.sub(cleankey, '', newurl)
                              if renewurl != newurl:
                                  delete = True
      
      
      Severity: Major
      Found in stampy/plugin/cleanlink.py - About 45 mins to fix

        Function sendimage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def sendimage(chat_id=0, image="", text="", reply_to_message_id=""):
            """
            Sends an image to chat_id as a reply to a message received
            :param chat_id: ID of the chat
            :param image: image URI
        Severity: Minor
        Found in stampy/stampy.py - 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

        Function updatestats has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def updatestats(type=False, id=0, name=False, date=False, memberid=None):
        Severity: Minor
        Found in stampy/plugin/stats.py - About 35 mins to fix

          Function getstats has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def getstats(type=False, id=0, name=False, date=False, count=0):
          Severity: Minor
          Found in stampy/plugin/stats.py - About 35 mins to fix

            Function remove_from_memberid has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def remove_from_memberid(type=False, id=0, name=False, date=False, memberid=None):
            Severity: Minor
            Found in stampy/plugin/stats.py - About 35 mins to fix

              Function whois has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              def whois(chat_id=False, user_id=False):
                  """
                  Use API call to retrieve userid
                  :param chat_id:  chat id to locate user into
                  :param user_id:  user id to kick out of chat
              Severity: Minor
              Found in stampy/plugin/irccommands.py - 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

              Function autokarmawords has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              def autokarmawords(message):
                  """
                  Finds commands affecting autokarma in messages
                  :param message: message to process
                  :return:
              Severity: Minor
              Found in stampy/plugin/autokarma.py - 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

              Function helpcommands has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              def helpcommands(message):
                  """
                  Searches for commands related to help
                  :param message: nessage to process
                  :return:
              Severity: Minor
              Found in stampy/plugin/help.py - 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

              Avoid too many return statements within this function.
              Open

                  return
              Severity: Major
              Found in stampy/plugin/irccommands.py - About 30 mins to fix

                Function unban has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def unban(chat_id=False, user_id=False):
                    """
                    Use API call to have the bot unban user
                    :param chat_id: Channel ID to unban user on
                    :param user_id: User ID to unban
                Severity: Minor
                Found in stampy/plugin/irccommands.py - 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

                Function getstats has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def getstats(type=False, id=0, name=False, date=False, count=0):
                    """
                    Gets statistics for specified element
                    :param type: chat or user type to query
                    :param id: identifier for user or chat
                Severity: Minor
                Found in stampy/plugin/stats.py - 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

                Function rank has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def rank(word=False, gid=0):
                    """
                    Outputs rank for word or top 10
                    :param gid: Group ID to filter
                    :param word: word to return rank for
                Severity: Minor
                Found in stampy/plugin/karma.py - 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

                Function showstats has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def showstats(type=False, name=None, key="name"):
                    """
                    Shows stats for defined type or all if missing
                    :param name: name to search in the stats database
                    :param type: user or chat or empy for combined
                Severity: Minor
                Found in stampy/plugin/stats.py - 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

                Function get_currency_rate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def get_currency_rate(currency, rate_in):
                    """
                    Get currency rate
                    :param currency: Original Currency
                    :param rate_in: Destination Currency
                Severity: Minor
                Found in stampy/plugin/stock.py - 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