borgbackup/borg

View on GitHub

Showing 507 of 611 total issues

File archive.py has 1968 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import base64
import errno
import json
import os
import stat
Severity: Major
Found in src/borg/archive.py - About 5 days to fix

    File legacyrepository.py has 1437 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import errno
    import mmap
    import os
    import shutil
    import stat
    Severity: Major
    Found in src/borg/legacyrepository.py - About 3 days to fix

      Function call_many has a Cognitive Complexity of 172 (exceeds 5 allowed). Consider refactoring.
      Open

          def call_many(self, cmd, calls, wait=True, is_preloaded=False, async_wait=True):
              if not calls and cmd != "async_responses":
                  return
      
              def send_buffer():
      Severity: Minor
      Found in src/borg/remote.py - About 3 days 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 call_many has a Cognitive Complexity of 171 (exceeds 5 allowed). Consider refactoring.
      Open

          def call_many(self, cmd, calls, wait=True, is_preloaded=False, async_wait=True):
              if not calls and cmd != "async_responses":
                  return
      
              def send_buffer():
      Severity: Minor
      Found in src/borg/legacyremote.py - About 3 days 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

      File helpers_test.py has 1196 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import base64
      import errno
      import getpass
      import hashlib
      import os
      Severity: Major
      Found in src/borg/testsuite/helpers_test.py - About 3 days to fix

        File remote.py has 1061 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import atexit
        import errno
        import functools
        import inspect
        import logging
        Severity: Major
        Found in src/borg/remote.py - About 2 days to fix

          Function do_create has a Cognitive Complexity of 127 (exceeds 5 allowed). Consider refactoring.
          Open

              def do_create(self, args, repository, manifest):
                  """Create new archive"""
                  key = manifest.key
                  matcher = PatternMatcher(fallback=True)
                  matcher.add_inclexcl(args.patterns)
          Severity: Minor
          Found in src/borg/archiver/create_cmd.py - About 2 days 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 rebuild_archives has a Cognitive Complexity of 125 (exceeds 5 allowed). Consider refactoring.
          Open

              def rebuild_archives(
                  self, first=0, last=0, sort_by="", match=None, older=None, newer=None, oldest=None, newest=None
              ):
                  """Analyze and rebuild archives, expecting some damage and trying to make stuff consistent again."""
          
          
          Severity: Minor
          Found in src/borg/archive.py - About 2 days 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

          File parseformat.py has 991 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import abc
          import argparse
          import base64
          import binascii
          import hashlib
          Severity: Major
          Found in src/borg/helpers/parseformat.py - About 2 days to fix

            File create_cmd.py has 851 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import errno
            import sys
            import argparse
            import logging
            import os
            Severity: Major
            Found in src/borg/archiver/create_cmd.py - About 2 days to fix

              File legacyrepository_test.py has 832 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import logging
              import os
              import sys
              from typing import Optional
              from unittest.mock import patch
              Severity: Major
              Found in src/borg/testsuite/legacyrepository_test.py - About 2 days to fix

                Function do_transfer has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
                Open

                    def do_transfer(self, args, *, repository, manifest, cache, other_repository=None, other_manifest=None):
                        """archives transfer from other repository, optionally upgrade data format"""
                        key = manifest.key
                        other_key = other_manifest.key
                        if not uses_same_id_hash(other_key, key):
                Severity: Minor
                Found in src/borg/archiver/transfer_cmd.py - About 1 day 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

                File legacyremote.py has 763 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import errno
                import functools
                import inspect
                import logging
                import os
                Severity: Major
                Found in src/borg/legacyremote.py - About 1 day to fix

                  File create_cmd_test.py has 751 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import errno
                  import json
                  import os
                  import tempfile
                  import shutil
                  Severity: Major
                  Found in src/borg/testsuite/archiver/create_cmd_test.py - About 1 day to fix

                    File key.py has 750 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import binascii
                    import hmac
                    import os
                    import textwrap
                    from hashlib import sha256, pbkdf2_hmac
                    Severity: Major
                    Found in src/borg/crypto/key.py - About 1 day to fix

                      Function extract_item has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def extract_item(
                              self,
                              item,
                              *,
                              restore_attrs=True,
                      Severity: Minor
                      Found in src/borg/archive.py - About 1 day 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 serve has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def serve(self):
                              def inner_serve():
                                  os.set_blocking(self.stdin_fd, False)
                                  assert not os.get_blocking(self.stdin_fd)
                                  os.set_blocking(self.stdout_fd, True)
                      Severity: Minor
                      Found in src/borg/remote.py - About 1 day 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

                      File cache.py has 725 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import configparser
                      import io
                      import os
                      import shutil
                      import stat
                      Severity: Major
                      Found in src/borg/cache.py - About 1 day to fix

                        Function rst_to_text has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def rst_to_text(text, state_hook=None, references=None):
                            """
                            Convert rST to a more human text form.
                        
                            This is a very loose conversion. No advanced rST features are supported.
                        Severity: Minor
                        Found in src/borg/helpers/nanorst.py - About 1 day 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 test_transfer_upgrade has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def test_transfer_upgrade(archivers, request):
                            archiver = request.getfixturevalue(archivers)
                            if archiver.get_kind() in ["remote", "binary"]:
                                pytest.skip("only works locally")
                        
                        
                        Severity: Minor
                        Found in src/borg/testsuite/archiver/transfer_cmd_test.py - About 1 day 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