leandrotoledo/python-telegram-bot

View on GitHub

Showing 351 of 351 total issues

File _giveaway.py has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2024
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
Severity: Minor
Found in telegram/_giveaway.py - About 2 hrs to fix

    Function __init__ has 18 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in telegram/_poll.py - About 2 hrs to fix

      Function effective_chat has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def effective_chat(self) -> Optional["Chat"]:
              """
              :class:`telegram.Chat`: The chat that this update was sent in, no matter what kind of
              update this is.
              If no chat is associated with this update, this gives :obj:`None`.
      Severity: Minor
      Found in telegram/_update.py - About 2 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 __init__ has 18 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in telegram/_files/sticker.py - About 2 hrs to fix

        Function autodoc_process_bases has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        def autodoc_process_bases(app, name, obj, option, bases: list) -> None:
            """Here we fine tune how the base class's classes are displayed."""
            for idx, raw_base in enumerate(bases):
                # let's use a string representation of the object
                base = str(raw_base)
        Severity: Minor
        Found in docs/auxil/sphinx_hooks.py - About 2 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

        ContextTypes has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class ContextTypes(Generic[CCT, UD, CD, BD]):
            """
            Convenience class to gather customizable types of the :class:`telegram.ext.CallbackContext`
            interface.
        
        
        Severity: Minor
        Found in telegram/ext/_contexttypes.py - About 2 hrs to fix

          Function __init__ has 17 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in telegram/_inline/inlinequeryresultvideo.py - About 2 hrs to fix

            Function __init__ has 17 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Major
            Found in telegram/_chatadministratorrights.py - About 2 hrs to fix

              Function __init__ has 17 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Major
              Found in telegram/_inline/inlinequeryresultvenue.py - About 2 hrs to fix

                Function effective_user has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def effective_user(self) -> Optional["User"]:
                        """
                        :class:`telegram.User`: The user that sent this update, no matter what kind of update this
                        is. If no user is associated with this update, this gives :obj:`None`. This is the case
                        if any of
                Severity: Minor
                Found in telegram/_update.py - About 2 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_message has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __process_message(self, message: Message) -> Optional[str]:
                        """As documented in process_message, but returns the uuid of the attached keyboard, if any,
                        which is relevant for process_callback_query.
                
                        **IN PLACE**
                Severity: Minor
                Found in telegram/ext/_callbackdatacache.py - About 2 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 __init__ has 16 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(
                Severity: Major
                Found in telegram/_inline/inlinequeryresultgif.py - About 2 hrs to fix

                  Function __init__ has 16 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(
                  Severity: Major
                  Found in telegram/_passport/encryptedpassportelement.py - About 2 hrs to fix

                    Function __init__ has 16 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(
                    Severity: Major
                    Found in telegram/_inline/inlinequeryresultmpeg4gif.py - About 2 hrs to fix

                      Function __init__ has 16 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def __init__(
                      Severity: Major
                      Found in telegram/_inline/inlinequeryresultdocument.py - About 2 hrs to fix

                        Function __init__ has 16 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def __init__(
                        Severity: Major
                        Found in telegram/_chatpermissions.py - About 2 hrs to fix

                          Function __init__ has 16 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def __init__(
                          Severity: Major
                          Found in telegram/_inline/inlinequeryresultlocation.py - About 2 hrs to fix

                            Function __init__ has 15 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def __init__(
                            Severity: Major
                            Found in telegram/_inline/inlinequeryresultphoto.py - About 1 hr to fix

                              Function run_webhook has 15 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def run_webhook(
                              Severity: Major
                              Found in telegram/ext/_application.py - About 1 hr to fix

                                Function __init__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def __init__(
                                        self,
                                        token: str,
                                        base_url: str = "https://api.telegram.org/bot",
                                        base_file_url: str = "https://api.telegram.org/file/bot",
                                Severity: Minor
                                Found in telegram/_bot.py - 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

                                Severity
                                Category
                                Status
                                Source
                                Language