leandrotoledo/python-telegram-bot

View on GitHub
telegram/ext/_application.py

Summary

Maintainability
F
4 days
Test Coverage

File _application.py has 1449 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: Major
Found in telegram/ext/_application.py - About 3 days 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 run_polling has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

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

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

          Function __init__ has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def __init__(
                  self: "Application[BT, CCT, UD, CD, BD, JQ]",
                  *,
                  bot: BT,
                  update_queue: "asyncio.Queue[object]",
          Severity: Minor
          Found in telegram/ext/_application.py - About 1 hr to fix

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

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

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

                  def create_task(
              Severity: Minor
              Found in telegram/ext/_application.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

                There are no issues that match your filters.

                Category
                Status