Showing 507 of 611 total issues
Function do_info
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def do_info(self, args, repository, manifest, cache):
"""Show archive details such as disk space used"""
if args.name:
archive_infos = [manifest.archives.get_one([args.name])]
- Read upRead up
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 preprocess_args
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def preprocess_args(self, args):
deprecations = [
# ('--old', '--new' or None, 'Warning: "--old" has been deprecated. Use "--new" instead.'),
]
for i, arg in enumerate(args[:]):
- Read upRead up
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 run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def run(self, args):
os.umask(args.umask) # early, before opening files
self.lock_wait = args.lock_wait
func = get_func(args)
# do not use loggers before this!
- Read upRead up
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 build_chunkindex_from_repo
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def build_chunkindex_from_repo(repository, *, disable_caches=False, cache_immediately=False):
chunks = None
# first, try to load a pre-computed and centrally cached chunks index:
if not disable_caches:
wanted_hash = load_chunks_hash(repository)
- Read upRead up
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_repo_compress
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_repo_compress(archiver):
def check_compression(ctype, clevel, olevel):
"""check if all the chunks in the repo are compressed/obfuscated like expected"""
repository = Repository(archiver.repository_path, exclusive=True)
with repository:
Function build_parser_tar
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_parser_tar(self, subparsers, common_parser, mid_common_parser):
from ._common import process_epilog
export_tar_epilog = process_epilog(
"""
Function test_basic_functionality
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_basic_functionality(archivers, request):
archiver = request.getfixturevalue(archivers)
if archiver.EXE:
pytest.skip("test_basic_functionality seems incompatible with fakeroot and/or the binary.")
have_root = create_test_files(archiver.input_path)
Function test_debug_id_hash_format_put_get_parse_obj
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_debug_id_hash_format_put_get_parse_obj(archivers, request):
"""Test format-obj and parse-obj commands"""
archiver = request.getfixturevalue(archivers)
cmd(archiver, "repo-create", RK_ENCRYPTION)
data = b"some data" * 100
Function open
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def open(
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, *, noatime, noctime, nobirthtime, numeric_ids, noflags, noacls, noxattrs):
Function rebuild_archives
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def rebuild_archives(
Consider simplifying this complex logical expression. Open
if item.path.endswith("directory") or item.path.endswith("borgtest"):
assert stat.S_ISDIR(item.mode)
assert item.uid > 0
assert "hlid" not in item
elif item.path.endswith("no_hardlink") or item.path.endswith("target"):
Function format
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def format(
Function _create_archive_ts
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_archive_ts(archiver, name, y, m, d, H=0, M=0, S=0):
Function format
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def format(
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function find_key
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_key(self):
if self.STORAGE == KeyBlobStorage.KEYFILE:
keyfile = self._find_key_file_from_environment()
if keyfile is not None:
return self.sanity_check(keyfile, self.repository.id)
- Read upRead up
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 set_all
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_all(path, xattrs, follow_symlinks=False):
"""
Set all extended attributes on *path* from a mapping.
*path* can either be a path (str or bytes) or an open file descriptor (int).
- Read upRead up
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 add_entry
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def add_entry(self, key, data, cache, complete):
transformed = self.transform(key, data)
if not cache:
return transformed
packed = self.pack(transformed)
- Read upRead up
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 write_options_group
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def write_options_group(self, write, group):
def is_positional_group(group):
return any(not o.option_strings for o in group._group_actions)
if is_positional_group(group):
- Read upRead up
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"