leandrotoledo/python-telegram-bot

View on GitHub
telegram/ext/_jobqueue.py

Summary

Maintainability
D
2 days
Test Coverage

File _jobqueue.py has 753 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/_jobqueue.py - About 1 day to fix

    Function run_repeating has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Function run_daily has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

        Function run_monthly has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

          Function _parse_time_input has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def _parse_time_input(
                  self,
                  time: Union[float, datetime.timedelta, datetime.datetime, datetime.time, None],
                  shift_day: bool = False,
              ) -> Optional[datetime.datetime]:
          Severity: Minor
          Found in telegram/ext/_jobqueue.py - About 55 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 run_once has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def run_once(
          Severity: Major
          Found in telegram/ext/_jobqueue.py - About 50 mins to fix

            Function run_custom has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def run_custom(
            Severity: Minor
            Found in telegram/ext/_jobqueue.py - About 45 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

                Avoid too many return statements within this function.
                Open

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

                  There are no issues that match your filters.

                  Category
                  Status