Nekmo/telegram-upload

View on GitHub
telegram_upload/management.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function upload has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def upload(files, to, config, delete_on_success, print_file_id, force_file, forward, directories, large_files, caption,
           no_thumbnail, thumbnail_file, proxy, album, interactive, sort):
    """Upload one or more files to Telegram using your personal account.
    The maximum file size is 2 GiB for free users and 4 GiB for premium accounts.
    By default, they will be saved in your saved messages.
Severity: Minor
Found in telegram_upload/management.py - About 2 hrs 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 upload has 16 arguments (exceeds 4 allowed). Consider refactoring.
Open

def upload(files, to, config, delete_on_success, print_file_id, force_file, forward, directories, large_files, caption,
Severity: Major
Found in telegram_upload/management.py - About 2 hrs to fix

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

    def get_file_display_name(message):
        display_name_parts = []
        is_document = message.document
        if is_document and message.document.mime_type:
            display_name_parts.append(message.document.mime_type.split('/')[0])
    Severity: Minor
    Found in telegram_upload/management.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 download has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def download(from_, config, delete_on_success, proxy, split_files, interactive):
    Severity: Minor
    Found in telegram_upload/management.py - About 45 mins to fix

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

      def download(from_, config, delete_on_success, proxy, split_files, interactive):
          """Download all the latest messages that are files in a chat, by default download
          from "saved messages". It is recommended to forward the files to download to
          "saved messages" and use parameter ``--delete-on-success``. Forwarded messages will
          be removed from the chat after downloading, such as a download queue.
      Severity: Minor
      Found in telegram_upload/management.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