iranzo/stampython

View on GitHub

Showing 97 of 154 total issues

Function irccommands has a Cognitive Complexity of 129 (exceeds 5 allowed). Consider refactoring.
Open

def irccommands(message):
    """
    Processes kick, ban, etc commands in the messages
    :param message: message to process
    :return:
Severity: Minor
Found in stampy/plugin/irccommands.py - About 2 days 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

File stampy.py has 793 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# encoding: utf-8
#
# Description: Bot for controlling karma on Telegram
# Author: Pablo Iranzo Gomez (Pablo.Iranzo@gmail.com)
Severity: Major
Found in stampy/stampy.py - About 1 day to fix

    Function karmaprocess has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
    Open

    def karmaprocess(msgdetail):
        """
        Processes karma operators in text
        :param msgdetail: message details as per getmsgdetail
        :return:
    Severity: Minor
    Found in stampy/plugin/karma.py - 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

    Function feeds has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
    Open

    def feeds(message=False, name=False):
        """
        Shows feeds for 'name'
        :param message:  Message invoking feed
        :param name: Name of the feed to show
    Severity: Minor
    Found in stampy/plugin/feed.py - 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

    Function sendmessage has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
    Open

    def sendmessage(chat_id=0, text="", reply_to_message_id=False,
                    disable_web_page_preview=True, parse_mode=False,
                    extra=False):
        """
        Sends a message to a chat
    Severity: Minor
    Found in stampy/stampy.py - 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

    File stats.py has 599 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    # encoding: utf-8
    #
    # Description: Plugin for processing stats commands
    # Author: Pablo Iranzo Gomez (Pablo.Iranzo@gmail.com)
    Severity: Major
    Found in stampy/plugin/stats.py - About 1 day to fix

      Function configcommands has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
      Open

      def configcommands(message):
          """
          Processes configuration commands in the message
          :param message: message to process
          :return:
      Severity: Minor
      Found in stampy/plugin/config.py - 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

      Function rsscommands has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
      Open

      def rsscommands(message):
          """
          Processes feed commands in the message texts
          :param message: Message to process
          :return:
      Severity: Minor
      Found in stampy/plugin/feed.py - About 7 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

      Function dousercleanup has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

      def dousercleanup(user_id=False, maxage=int(stampy.plugin.config.config("maxage", default=180))):
          """
          Checks on the stats database the date of the last update from the user
          :param user_id: User ID to query in database
          :param maxage: defines maximum number of days to allow chats to be inactive
      Severity: Minor
      Found in stampy/plugin/stats.py - About 6 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

      Function quotecommands has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

      def quotecommands(message):
          """
          Searches for commands related to quotes
          :param message: message to process
          :return:
      Severity: Minor
      Found in stampy/plugin/quote.py - About 5 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

      Function comicfromurl has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

      def comicfromurl(name, forceurl=False):
          """
          Returns title, img and post url
          :param name: name of comic to process
          :return:
      Severity: Minor
      Found in stampy/plugin/comic.py - About 5 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

      Function dochatcleanup has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

      def dochatcleanup(chat_id=False, maxage=False):
          """
          Checks on the stats database the date of the last update in the chat
          :param chat_id: Channel ID to query in database
          :param maxage: defines maximum number of days to allow chats to be inactive
      Severity: Minor
      Found in stampy/plugin/stats.py - About 5 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

      Function sudocommands has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

      def sudocommands(message):
          """
          Processes alias commands in the message texts
          :param message: Message to process
          :return:
      Severity: Minor
      Found in stampy/plugin/sudo.py - About 5 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

      File irccommands.py has 387 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      # encoding: utf-8
      #
      # Description: Plugin for processing irc-like commands
      # Author: Pablo Iranzo Gomez (Pablo.Iranzo@gmail.com)
      Severity: Minor
      Found in stampy/plugin/irccommands.py - About 5 hrs to fix

        Function run has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

        def run(message):  # do not edit this line
            """
            Executes plugin
            :param message: message to run against
            :return:
        Severity: Minor
        Found in stampy/plugin/cleanlink.py - About 5 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

        Function comics has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

        def comics(message=False, name=False, all=False):
            """
            Shows Comics for 'name'
            :param message:  Message invoking comic
            :param name: Name of the comic to show
        Severity: Minor
        Found in stampy/plugin/comic.py - About 4 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

        Function admincommands has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

        def admincommands(message):
            """
            Processes link commands in the message
            :param message: message to process
            :return:
        Severity: Minor
        Found in stampy/plugin/admin.py - About 4 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

        File karma.py has 362 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #!/usr/bin/env python
        # encoding: utf-8
        #
        # Description: Plugin for processing karma commands
        # Author: Pablo Iranzo Gomez (Pablo.Iranzo@gmail.com)
        Severity: Minor
        Found in stampy/plugin/karma.py - About 4 hrs to fix

          Function run has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

          def run(message):  # do not edit this line
              """
              Executes plugin
              :param message: message to run against
              :return:
          Severity: Minor
          Found in stampy/plugin/stats.py - About 4 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

          Function process has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

          def process(messages):
              """
              This function processes the updates in the Updates URL at Telegram
              for finding commands, karma changes, config, etc
              """
          Severity: Minor
          Found in stampy/stampy.py - About 4 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

          Severity
          Category
          Status
          Source
          Language