leandrotoledo/python-telegram-bot

View on GitHub

Showing 334 of 334 total issues

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

    def __init__(
Severity: Minor
Found in telegram/ext/_aioratelimiter.py - About 35 mins to fix

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

        def __init__(
    Severity: Minor
    Found in telegram/_files/_basemedium.py - About 35 mins to fix

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

          def __init__(
      Severity: Minor
      Found in telegram/ext/_handlers/prefixhandler.py - About 35 mins to fix

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

            def __init__(
        Severity: Minor
        Found in telegram/ext/_jobqueue.py - About 35 mins to fix

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

              def __init__(
          Severity: Minor
          Found in telegram/_giveaway.py - About 35 mins to fix

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

                def __init__(
            Severity: Minor
            Found in telegram/_messageorigin.py - About 35 mins to fix

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

                  def __init__(
              Severity: Minor
              Found in telegram/_messageorigin.py - About 35 mins to fix

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

                    def process_link(
                Severity: Minor
                Found in docs/auxil/tg_const_role.py - About 35 mins to fix

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

                  def autodoc_process_bases(app, name, obj, option, bases: list) -> None:
                  Severity: Minor
                  Found in docs/auxil/sphinx_hooks.py - About 35 mins to fix

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

                        def __run(
                            self,
                            updater_coroutine: Coroutine,
                            stop_signals: ODVInput[Sequence[int]],
                            close_loop: bool = True,
                    Severity: Minor
                    Found in telegram/ext/_application.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 escape_markdown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def escape_markdown(
                        text: str, version: MarkdownVersion = 1, entity_type: Optional[str] = None
                    ) -> str:
                        """Helper function to escape telegram markup symbols.
                    
                    
                    Severity: Minor
                    Found in telegram/helpers.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 de_json has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def de_json(cls, data: Optional[JSONDict], bot: "Bot") -> Optional["InlineKeyboardMarkup"]:
                            """See :meth:`telegram.TelegramObject.de_json`."""
                            if not data:
                                return None
                    
                    
                    Severity: Minor
                    Found in telegram/_inline/inlinekeyboardmarkup.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 link has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def link(self) -> Optional[str]:
                            """:obj:`str`: Convenience property. If the chat of the message is not
                            a private chat or normal group, returns a t.me link of the message.
                    
                                .. versionchanged:: 20.3
                    Severity: Minor
                    Found in telegram/_message.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 updater has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def updater(self: BuilderType, updater: Optional[Updater]) -> BuilderType:
                            """Sets a :class:`telegram.ext.Updater` instance for
                            :attr:`telegram.ext.Application.updater`. The :attr:`telegram.ext.Updater.bot` and
                            :attr:`telegram.ext.Updater.update_queue` will be used for
                            :attr:`telegram.ext.Application.bot` and :attr:`telegram.ext.Application.update_queue`,
                    Severity: Minor
                    Found in telegram/ext/_applicationbuilder.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 _build_request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _build_request(self, get_updates: bool) -> BaseRequest:
                            prefix = "_get_updates_" if get_updates else "_"
                            if not isinstance(getattr(self, f"{prefix}request"), DefaultValue):
                                return getattr(self, f"{prefix}request")
                    
                    
                    Severity: Minor
                    Found in telegram/ext/_applicationbuilder.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 InputFile(file_input, filename=filename, attach=attach)
                    Severity: Major
                    Found in telegram/_utils/files.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return file_input
                      Severity: Major
                      Found in telegram/_utils/files.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return InputFile(cast(IO, file_input), filename=filename, attach=attach)
                        Severity: Major
                        Found in telegram/_utils/files.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return file_input.file_id  # type: ignore[attr-defined]
                          Severity: Major
                          Found in telegram/_utils/files.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return time
                            Severity: Major
                            Found in telegram/ext/_jobqueue.py - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language