Nekmo/telegram-upload

View on GitHub
telegram_upload/client/telegram_upload_client.py

Summary

Maintainability
C
7 hrs
Test Coverage

File telegram_upload_client.py has 319 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import asyncio
import hashlib
import os
import time
from typing import Iterable, Optional
Severity: Minor
Found in telegram_upload/client/telegram_upload_client.py - About 3 hrs to fix

    Function send_files has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def send_files(self, entity, files: Iterable[File], delete_on_success=False, print_file_id=False,
                       forward=(), send_as_media: bool = False):
            has_files = False
            messages = []
            for file in files:
    Severity: Minor
    Found in telegram_upload/client/telegram_upload_client.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 send_files has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def send_files(self, entity, files: Iterable[File], delete_on_success=False, print_file_id=False,
    Severity: Minor
    Found in telegram_upload/client/telegram_upload_client.py - About 45 mins to fix

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

          def send_files_as_album(self, entity, files, delete_on_success=False, print_file_id=False,
      Severity: Minor
      Found in telegram_upload/client/telegram_upload_client.py - About 35 mins to fix

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

            def send_one_file(self, entity, file: File, send_as_media: bool = False, thumb: Optional[str] = None,
        Severity: Minor
        Found in telegram_upload/client/telegram_upload_client.py - About 35 mins to fix

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

              def send_one_file(self, entity, file: File, send_as_media: bool = False, thumb: Optional[str] = None,
                                retries=RETRIES):
                  message = None
                  progress, bar = get_progress_bar('Uploading', file.file_name, file.file_size)
          
          
          Severity: Minor
          Found in telegram_upload/client/telegram_upload_client.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