leandrotoledo/python-telegram-bot

View on GitHub
telegram/_chat.py

Summary

Maintainability
F
1 wk
Test Coverage

File _chat.py has 3208 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: Major
Found in telegram/_chat.py - About 1 wk 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

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

          def __init__(
              self,
              id: int,
              type: str,
              title: Optional[str] = None,
      Severity: Minor
      Found in telegram/_chat.py - About 1 hr to fix

        Function mention_markdown_v2 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def mention_markdown_v2(self, name: Optional[str] = None) -> str:
                """
                .. versionadded:: 20.0
        
                Args:
        Severity: Minor
        Found in telegram/_chat.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 mention_html has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def mention_html(self, name: Optional[str] = None) -> str:
                """
                .. versionadded:: 20.0
        
                Args:
        Severity: Minor
        Found in telegram/_chat.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 mention_markdown has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def mention_markdown(self, name: Optional[str] = None) -> str:
                """
                Note:
                    :tg-const:`telegram.constants.ParseMode.MARKDOWN` is a legacy mode, retained by
                    Telegram for backward compatibility. You should use :meth:`mention_markdown_v2`
        Severity: Minor
        Found in telegram/_chat.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

        There are no issues that match your filters.

        Category
        Status