Nekmo/telegram-upload

View on GitHub

Showing 34 of 34 total issues

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 get_video_thumb has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_video_thumb(file, output=None, size=200):
        output = output or tempfile.NamedTemporaryFile(suffix='.jpg').name
        metadata = video_metadata(file)
        if metadata is None:
            return
    Severity: Minor
    Found in telegram_upload/video.py - About 45 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 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 _iter_download_chunk_tasks has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _iter_download_chunk_tasks(self, input_location, part_size, dc_id, msg_data, file_size):
      Severity: Minor
      Found in telegram_upload/client/telegram_download_client.py - About 35 mins to fix

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

            def __init__(self, client: 'TelegramManagerClient', files, thumbnail: Union[str, bool, None] = None,
        Severity: Minor
        Found in telegram_upload/upload_files.py - About 35 mins to fix

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

          def benchmark_file_size(client: TelegramManagerClient, size: int, repeats: int = REPEATS, wait: int = 0,
          Severity: Minor
          Found in docs/upload_benchmark.py - About 35 mins to fix

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

                def __init__(self, client: 'TelegramManagerClient', path: str, force_file: Union[bool, None] = None,
            Severity: Minor
            Found in telegram_upload/upload_files.py - About 35 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

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

                      def get_thumbnail(self):
                          thumb = None
                          if self._thumbnail is None and not self.force_file:
                              try:
                                  thumb = get_file_thumb(self.path)
                  Severity: Minor
                  Found in telegram_upload/upload_files.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

                  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

                  Function parse_proxy_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def parse_proxy_string(proxy: Union[str, None]):
                      if not proxy:
                          return None
                      proxy_parsed = urlparse(proxy)
                      if not proxy_parsed.scheme or not proxy_parsed.hostname or not proxy_parsed.port:
                  Severity: Minor
                  Found in telegram_upload/client/telegram_manager_client.py - About 25 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 upload_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def upload_file(extension: str = "", directory: str = ""):
                      """Upload a file to Telegram by extension"""
                      extensions = []
                      if not directory:
                          directory = tempfile.gettempdir()
                  Severity: Minor
                  Found in docs/supported_file_types.py - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language