borgbackup/borg

View on GitHub

Showing 477 of 591 total issues

File archive.py has 2159 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 repository.py has 1503 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/repository.py - About 4 days to fix

      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/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

      File helpers.py has 1202 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.py - About 3 days to fix

        File parseformat.py has 1038 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

          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

          File remote.py has 1015 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

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

            import configparser
            import os
            import shutil
            import stat
            from collections import namedtuple
            Severity: Major
            Found in src/borg/cache.py - About 2 days to fix

              Function rebuild_refcounts has a Cognitive Complexity of 119 (exceeds 5 allowed). Consider refactoring.
              Open

                  def rebuild_refcounts(
                      self, first=0, last=0, sort_by="", match=None, older=None, newer=None, oldest=None, newest=None
                  ):
                      """Rebuild object reference counts by walking the metadata
              
              
              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 repository.py has 910 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/repository.py - About 2 days to fix

                File create_cmd.py has 885 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 create_cmd.py has 806 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import errno
                  import json
                  import os
                  import tempfile
                  from random import randbytes
                  Severity: Major
                  Found in src/borg/testsuite/archiver/create_cmd.py - About 1 day to fix

                    Function do_transfer has a Cognitive Complexity of 89 (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 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 do_config has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def do_config(self, args, repository):
                              """get, set, and delete values in a repository or cache config file"""
                      
                              def repo_validate(section, name, value=None, check_value=True):
                                  if section not in ["repository"]:
                      Severity: Minor
                      Found in src/borg/archiver/config_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

                      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

                      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

                      File debug_cmd.py has 644 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import argparse
                      import functools
                      import json
                      import textwrap
                      
                      
                      Severity: Major
                      Found in src/borg/archiver/debug_cmd.py - About 1 day to fix

                        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.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