Showing 26 of 61 total issues
File snapshotting.py
has 546 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import (absolute_import, print_function)
# From system
import os
import re
Function upload_file
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def upload_file(bucket, source, destination, s3_ssenc, bufsize, reduced_redundancy, rate_limit, quiet):
mp = None
retry_count = 0
sleep_time = SLEEP_TIME
while True:
- 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 create_upload_manifest
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def create_upload_manifest(
snapshot_name, snapshot_keyspaces, snapshot_table,
conf_path, manifest_path, exclude_tables, incremental_backups=False):
if snapshot_keyspaces:
keyspace_globs = snapshot_keyspaces.split(',')
- 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
File main.py
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import (absolute_import, print_function)
# From system
from collections import defaultdict
from fabric.api import env
Function __init__
has 22 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, aws_secret_access_key,
File agent.py
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import (absolute_import, print_function)
import boto
from boto.s3.connection import S3Connection
from yaml import load
Function node_start_backup
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def node_start_backup(self, snapshot, incremental_backups):
"""Runs snapshot command on a cassandra node"""
def run_cmd(cmd):
with hide('running', 'stdout', 'stderr'):
- 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 main
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main():
base_parser = add_s3_arguments(_base_parser)
subparsers = base_parser.add_subparsers(
title='subcommands', dest='subcommand'
)
Function upload_node_backups
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def upload_node_backups(self, snapshot, incremental_backups):
prefix = os.path.join(snapshot.base_path,
self.get_current_node_hostname())
manifest_path = '/tmp/backupmanifest'
- 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 put_from_manifest
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_from_manifest(
Function configure
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def configure(*args, **kwargs):
"""
Configure logging.
Borrowed from logging.basicConfig
Uses the IndentFormatter instead of the regular Formatter
- 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 restore
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def restore(self, keyspace, table, hosts, target_hosts):
table_log = "table: %s" % table if table else ''
snap_name = os.path.basename(self.snapshot.base_path)
logging.info("Restoring keyspace: %(keyspace)s %(table)s "
"from backup %(snap)s" %
- 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 restore_backup
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def restore_backup(args):
snapshots = SnapshotCollection(
args.aws_access_key_id,
args.aws_secret_access_key,
args.s3_base_path,
- 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 __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, aws_access_key_id, aws_secret_access_key, snapshot,
Function upload_file
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def upload_file(bucket, source, destination, s3_ssenc, bufsize, reduced_redundancy, rate_limit, quiet):
Function compressed_pipe
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def compressed_pipe(path, size, rate_limit, quiet):
"""
Returns a generator that yields compressed chunks of
the given file_path
- 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_backup
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def run_backup(args):
if args.user:
env.user = args.user
if args.password:
- 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 create_upload_manifest
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_upload_manifest(
Avoid deeply nested control flow statements. Open
if f.split('/')[-4] not in exclude_tables_list:
files.append(f.strip())
else:
Function _download_key
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _download_key(self, key):
r = self.keyspace_table_matcher.search(key.name)
keyspace = r.group(2)
table = r.group(3)
host = key.name.split('/')[2]
- 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"