borgbackup/borg

View on GitHub
src/borg/archiver/create_cmd.py

Summary

Maintainability
F
1 wk
Test Coverage

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

    Function _rec_walk has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
    Open

        def _rec_walk(
            self,
            *,
            path,
            parent_fd,
    Severity: Minor
    Found in src/borg/archiver/create_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 _process_any has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

        def _process_any(self, *, path, parent_fd, name, st, fso, cache, read_special, dry_run, strip_prefix):
            """
            Call the right method on the given FilesystemObjectProcessor.
            """
    
    
    Severity: Minor
    Found in src/borg/archiver/create_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 _rec_walk has 15 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _rec_walk(
    Severity: Major
    Found in src/borg/archiver/create_cmd.py - About 1 hr to fix

      Function build_parser_create has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def build_parser_create(self, subparsers, common_parser, mid_common_parser):
              from ._common import process_epilog
              from ._common import define_exclusion_group
      
              create_epilog = process_epilog(
      Severity: Minor
      Found in src/borg/archiver/create_cmd.py - About 1 hr to fix

        Function _process_any has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def _process_any(self, *, path, parent_fd, name, st, fso, cache, read_special, dry_run, strip_prefix):
        Severity: Major
        Found in src/borg/archiver/create_cmd.py - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                                      if not recurse_excluded_dir:
                                          if keep_exclude_tags:
                                              if not dry_run:
                                                  fso.process_dir_with_fd(
                                                      path=path, fd=child_fd, st=st, strip_prefix=strip_prefix
          Severity: Major
          Found in src/borg/archiver/create_cmd.py - About 45 mins to fix

            Avoid too many return statements within this function.
            Open

                                        return fso.process_file(
            Severity: Major
            Found in src/borg/archiver/create_cmd.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                      return fso.process_file(
              Severity: Major
              Found in src/borg/archiver/create_cmd.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                            return fso.process_symlink(
                Severity: Major
                Found in src/borg/archiver/create_cmd.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

                    Avoid too many return statements within this function.
                    Open

                                            return fso.process_dev(
                    Severity: Major
                    Found in src/borg/archiver/create_cmd.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

                        Avoid too many return statements within this function.
                        Open

                                                return fso.process_fifo(
                        Severity: Major
                        Found in src/borg/archiver/create_cmd.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                                  return fso.process_dev(
                          Severity: Major
                          Found in src/borg/archiver/create_cmd.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

                              Avoid too many return statements within this function.
                              Open

                                                      return fso.process_file(
                              Severity: Major
                              Found in src/borg/archiver/create_cmd.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

                                  Avoid too many return statements within this function.
                                  Open

                                                          return fso.process_file(
                                  Severity: Major
                                  Found in src/borg/archiver/create_cmd.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

                                      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

                                        There are no issues that match your filters.

                                        Category
                                        Status