borgbackup/borg

View on GitHub

Showing 611 of 611 total issues

Function add_chunk has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def add_chunk(self, id, meta, data, stats=None, wait=True, ro_type=None):
Severity: Major
Found in src/borg/testsuite/archive_test.py - About 50 mins to fix

    Function exec_cmd has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def exec_cmd(*args, archiver=None, fork=False, exe=None, input=b"", binary_output=False, **kw):
    Severity: Major
    Found in src/borg/testsuite/archiver/__init__.py - About 50 mins to fix

      Function acquire_release_loop has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def acquire_release_loop(
      Severity: Major
      Found in src/borg/testsuite/fslocking_test.py - About 50 mins to fix

        Function _process_leaf has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def _process_leaf(self, name, item, parent, prefix, is_dir, item_inode, hlm):
        Severity: Major
        Found in src/borg/fuse.py - About 50 mins to fix

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

          def get_acl(path, numeric_ids=False):
              item = {}
              acl_get(path, item, os.stat(path), numeric_ids=numeric_ids)
              return item
          Severity: Major
          Found in src/borg/testsuite/platform_freebsd_test.py and 2 other locations - About 50 mins to fix
          src/borg/testsuite/platform_darwin_test.py on lines 11..14
          src/borg/testsuite/platform_linux_test.py on lines 38..41

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  self.assert_equal(parts, [data[0:4096], data[4096:8192], data[8192:]])
          Severity: Minor
          Found in src/borg/testsuite/chunker_test.py and 1 other location - About 50 mins to fix
          src/borg/testsuite/chunker_test.py on lines 32..32

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

          def get_acl(path, numeric_ids=False):
              item = {}
              acl_get(path, item, os.stat(path), numeric_ids=numeric_ids)
              return item
          Severity: Major
          Found in src/borg/testsuite/platform_darwin_test.py and 2 other locations - About 50 mins to fix
          src/borg/testsuite/platform_freebsd_test.py on lines 38..41
          src/borg/testsuite/platform_linux_test.py on lines 38..41

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

          def get_acl(path, numeric_ids=False):
              item = {}
              acl_get(path, item, os.stat(path), numeric_ids=numeric_ids)
              return item
          Severity: Major
          Found in src/borg/testsuite/platform_linux_test.py and 2 other locations - About 50 mins to fix
          src/borg/testsuite/platform_darwin_test.py on lines 11..14
          src/borg/testsuite/platform_freebsd_test.py on lines 38..41

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  self.assert_equal(parts, [data[0:4096], data[4096:8192], data[8192:]])
          Severity: Minor
          Found in src/borg/testsuite/chunker_test.py and 1 other location - About 50 mins to fix
          src/borg/testsuite/chunker_test.py on lines 47..47

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          if char == next == "`":
                              state_hook(state, "``", out)
                              state = "``"
                              text.read(1)
                              continue
          Severity: Minor
          Found in src/borg/helpers/nanorst.py and 1 other location - About 50 mins to fix
          src/borg/helpers/nanorst.py on lines 82..86

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          if char == next == "*":
                              state_hook(state, "**", out)
                              state = "**"
                              text.read(1)
                              continue
          Severity: Minor
          Found in src/borg/helpers/nanorst.py and 1 other location - About 50 mins to fix
          src/borg/helpers/nanorst.py on lines 87..91

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function argon2 has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def argon2(
          Severity: Minor
          Found in src/borg/crypto/key.py - About 45 mins to fix

            Function cache_if_remote has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def cache_if_remote(repository, *, decrypted_cache=False, pack=None, unpack=None, transform=None, force_cache=False):
                """
                Return a Repository(No)Cache for *repository*.
            
                If *decrypted_cache* is a repo_objs object, then get and get_many will return a tuple
            Severity: Minor
            Found in src/borg/remote.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 dir_is_tagged has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def dir_is_tagged(path, exclude_caches, exclude_if_present):
                """Determines whether the specified path is excluded by being a cache
                directory or containing user-specified tag files/directories. Returns a
                list of the names of the tag files/directories (either CACHEDIR.TAG or the
                matching user-specified files/directories).
            Severity: Minor
            Found in src/borg/helpers/fs.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 inject_exception has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def inject_exception(self, kind):
                    s1 = "test string"
                    s2 = "test string2"
                    if kind == "DoesNotExist":
                        raise self.RepoCls.DoesNotExist(s1)
            Severity: Minor
            Found in src/borg/remote.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 _mkstemp_inner has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def _mkstemp_inner(dir, pre, suf, flags, output_type, mode=0o600):
            Severity: Minor
            Found in src/borg/helpers/fs.py - About 45 mins to fix

              Function ids has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def ids(self):
                      # yield the binary IDs of all archives
                      if not self.legacy:
                          try:
                              infos = list(self.repository.store_list("archives"))
              Severity: Minor
              Found in src/borg/manifest.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

              Avoid deeply nested control flow statements.
              Open

                                      if lr_dict is not None:
                                          # Re-emit remote log messages locally.
                                          _logger = logging.getLogger(lr_dict["name"])
                                          if _logger.isEnabledFor(lr_dict["level"]):
                                              _logger.handle(logging.LogRecord(**lr_dict))
              Severity: Major
              Found in src/borg/remote.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if is_preloaded:
                                            assert cmd == "get", "is_preload is only supported for 'get'"
                                            if calls[0]["id"] in self.chunkid_to_msgids:
                                                waiting_for.append(pop_preload_msgid(calls.pop(0)["id"]))
                                        else:
                Severity: Major
                Found in src/borg/remote.py - About 45 mins to fix

                  Function load has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def load(cls, repository, operations, key=None, *, ro_cls=RepoObj):
                  Severity: Minor
                  Found in src/borg/manifest.py - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language