leandrotoledo/python-telegram-bot

View on GitHub

Showing 334 of 334 total issues

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

    def de_json_decrypted(
        cls, data: Optional[JSONDict], bot: "Bot", credentials: "Credentials"
    ) -> Optional["EncryptedPassportElement"]:
        """Variant of :meth:`telegram.TelegramObject.de_json` that also takes into account
        passport credentials.
Severity: Minor
Found in telegram/_passport/encryptedpassportelement.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

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

    def check_update(
        self, update: object
    ) -> Optional[Union[bool, Tuple[List[str], Optional[Union[bool, FilterDataDict]]]]]:
        """Determines whether an update should be passed to this handler's :attr:`callback`.

Severity: Minor
Found in telegram/ext/_handlers/commandhandler.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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      def __init__(self: "InitApplicationBuilder"):
                          self._token: DVType[str] = DefaultValue("")
                          self._base_url: DVType[str] = DefaultValue("https://api.telegram.org/bot")
                          self._base_file_url: DVType[str] = DefaultValue("https://api.telegram.org/file/bot")
                          self._connection_pool_size: DVInput[int] = DEFAULT_NONE
                  Severity: Minor
                  Found in telegram/ext/_applicationbuilder.py - About 1 hr to fix

                    Function _get_attrs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _get_attrs(
                            self,
                            include_private: bool = False,
                            recursive: bool = False,
                            remove_bot: bool = False,
                    Severity: Minor
                    Found in telegram/_telegramobject.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

                    Function _quote has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _quote(
                            self, quote: Optional[bool], reply_to_message_id: Optional[int] = None
                        ) -> Optional[ReplyParameters]:
                            """Modify kwargs for replying with or without quoting."""
                            if reply_to_message_id is not None:
                    Severity: Minor
                    Found in telegram/_message.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

                    Function get_optional_requirements has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def get_optional_requirements(raw: bool = False) -> Dict[str, List[str]]:
                        """Build the optional dependencies"""
                        requirements = defaultdict(list)
                    
                        with Path("requirements-opts.txt").open(encoding="utf-8") as reqs:
                    Severity: Minor
                    Found in setup.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

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

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

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

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

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

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

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

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

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

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

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

                                  def __init__(
                              Severity: Major
                              Found in telegram/_inline/inlinequeryresultcachedvideo.py - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language