leandrotoledo/python-telegram-bot

View on GitHub

Showing 334 of 334 total issues

Function _parse_markdown has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    def _parse_markdown(
        cls,
        message_text: Optional[str],
        entities: Dict[MessageEntity, str],
        urled: bool = False,
Severity: Minor
Found in telegram/_message.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

File __init__.py has 412 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/__init__.py - About 5 hrs to fix

    File credentials.py has 409 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/_passport/credentials.py - About 5 hrs to fix

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

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

        File _dictpersistence.py has 389 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/ext/_dictpersistence.py - About 5 hrs to fix

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

          #
          #  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 docs/auxil/admonition_inserter.py - About 5 hrs to fix

            File _reply.py has 379 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/_reply.py - About 5 hrs to fix

              Function _create_available_in has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _create_available_in(self) -> dict[type, str]:
                      """Creates a dictionary with 'Available in' admonitions for classes that are available
                      in attributes of other classes.
                      """
              
              
              Severity: Minor
              Found in docs/auxil/admonition_inserter.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 _baserequest.py has 350 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/request/_baserequest.py - About 4 hrs to fix

                File _callbackcontext.py has 348 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/ext/_callbackcontext.py - About 4 hrs to fix

                  File passportelementerrors.py has 341 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/_passport/passportelementerrors.py - About 4 hrs to fix

                    File _poll.py has 336 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/_poll.py - About 4 hrs to fix

                      File _callbackdatacache.py has 335 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/ext/_callbackdatacache.py - About 4 hrs to fix

                        File _business.py has 333 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        #!/usr/bin/env python
                        # pylint: disable=redefined-builtin
                        #
                        # A library that provides a Python interface to the Telegram Bot API
                        # Copyright (C) 2015-2024
                        Severity: Minor
                        Found in telegram/_business.py - About 4 hrs to fix

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

                              def __init__(
                                  self,
                                  store_data: Optional[PersistenceInput] = None,
                                  user_data_json: str = "",
                                  chat_data_json: str = "",
                          Severity: Minor
                          Found in telegram/ext/_dictpersistence.py - About 3 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 _basepersistence.py has 324 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/ext/_basepersistence.py - About 3 hrs to fix

                            File sticker.py has 323 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/_files/sticker.py - About 3 hrs to fix

                              Function _parse_html has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def _parse_html(
                                      cls,
                                      message_text: Optional[str],
                                      entities: Dict[MessageEntity, str],
                                      urled: bool = False,
                              Severity: Minor
                              Found in telegram/_message.py - About 3 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 filter has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def filter(self, update: Update) -> Union[bool, FilterDataDict]:
                                      base_output = self.base_filter.check_update(update)
                                      # We need to check if the filters are data filters and if so return the merged data.
                                      # If it's not a data filter or an or_filter but no matches return bool
                                      if self.and_filter:
                              Severity: Minor
                              Found in telegram/ext/filters.py - About 3 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 _chatboost.py has 312 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/_chatboost.py - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language