borgbackup/borg

View on GitHub

Showing 507 of 611 total issues

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

def generate_archiver_tests(metafunc, kinds: str):
    # Generate tests for different scenarios: local repository, remote repository, and using the borg binary.
    archivers = []
    for kind in kinds.split(","):
        if kind == "local":
Severity: Minor
Found in src/borg/testsuite/archiver/__init__.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 reopen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def reopen(repository, exclusive: Optional[bool] = True, create=False):
    if isinstance(repository, Repository):
        if repository.opened:
            raise RuntimeError("Repo must be closed before a reopen. Cannot support nested repository contexts.")
        return Repository(repository._location, exclusive=exclusive, create=create)
Severity: Minor
Found in src/borg/testsuite/repository_test.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 _create_filesystem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _create_filesystem(self):
        self._create_dir(parent=1)  # first call, create root dir (inode == 1)
        self.versions_index = FuseVersionsIndex()
        archives = self._manifest.archives.list_considering(self._args)
        name_counter = Counter(a.name for a in archives)
Severity: Minor
Found in src/borg/fuse.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 assert_no_manifest_replay has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def assert_no_manifest_replay(self, manifest, key):
        try:
            with open(self.manifest_ts_file) as fd:
                timestamp = fd.read()
            logger.debug("security: read manifest timestamp %r", timestamp)
Severity: Minor
Found in src/borg/cache.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

Avoid too many return statements within this function.
Open

                return dict(name=name, id=values["id"], time=values["time"])
Severity: Major
Found in src/borg/manifest.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return super().default(o)
    Severity: Major
    Found in src/borg/helpers/parseformat.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return default
      Severity: Major
      Found in src/borg/helpers/yes_no.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return ""
        Severity: Major
        Found in src/borg/helpers/parseformat.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return 1
          Severity: Major
          Found in scripts/make.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return False
            Severity: Major
            Found in src/borg/helpers/parseformat.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return ec1
              Severity: Major
              Found in src/borg/helpers/__init__.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return False
                Severity: Major
                Found in src/borg/legacyrepository.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return ec2
                  Severity: Major
                  Found in src/borg/helpers/__init__.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                            return
                    Severity: Major
                    Found in src/borg/archive.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                              return
                      Severity: Major
                      Found in src/borg/archive.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return EXIT_SUCCESS
                        Severity: Major
                        Found in src/borg/helpers/__init__.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return any(key_serialized.startswith(pattern) for pattern in keys_serialized)
                          Severity: Major
                          Found in src/borg/archive.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return seen_commit
                            Severity: Major
                            Found in src/borg/legacyrepository.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                                      return
                              Severity: Major
                              Found in src/borg/archive.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                    return
                                Severity: Major
                                Found in src/borg/archiver/create_cmd.py - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language