Showing 84 of 141 total issues
File shell.py
has 2592 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""
A powerful & scriptable ZooKeeper shell
"""
Shell
has 117 functions (exceeds 20 allowed). Consider refactoring. Open
class Shell(XCmd):
CONF_PATH = os.path.join(os.environ["HOME"], ".zk_shell")
DEFAULT_CONF = Conf(
ConfVar(
"chkzk_stat_retries",
Function __call__
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, params=None):
""" parse params & loop forever """
logging.basicConfig(level=logging.ERROR)
if params is None:
- 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 xclient.py
has 418 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
a decorated KazooClient with handy operations on a ZK datatree and its znodes
"""
from contextlib import contextmanager
import os
File copy_util.py
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
""" helpers to move files/dirs to and from ZK and also among ZK clusters """
from __future__ import print_function
from base64 import b64decode, b64encode
XClient
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
class XClient():
""" adds some extra methods to a wrapped KazooClient """
class CmdFailed(Exception):
""" 4 letter cmd failed """
Function connected
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def connected(func):
""" check connected, fails otherwise """
@wraps(func)
def wrapper(*args, **kwargs):
self = args[0]
- 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
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def set(cls, obj, keys, value, fill_list_value=None):
"""
sets the value for the given keys on obj. if any of the given
keys does not exist, create the intermediate containers.
"""
- 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 do_chkzk
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def do_chkzk(self, params):
"""
\x1b[1mNAME\x1b[0m
chkzk - Consistency check for a cluster
- 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 do_json_dupes_for_keys
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def do_json_dupes_for_keys(self, params):
"""
\x1b[1mNAME\x1b[0m
json_duples_for_keys - Gets the duplicate znodes for the given keys
- 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 get
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def get(self):
reqs = Queue()
child_pending = 1
data_pending = 0
path = self.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 check_path_exists_foreach
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def check_path_exists_foreach(path_params, func):
""" check that paths exist (unless we are in a transaction) """
@wraps(func)
def wrapper(*args):
self = args[0]
- 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 do_json_count_values
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def do_json_count_values(self, params):
"""
\x1b[1mNAME\x1b[0m
json_count_values - Gets the frequency of the values associated with the given keys
- 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 ephemerals_info
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def ephemerals_info(self, hosts):
"""Returns ClientInfo per path.
:param hosts: comma separated lists of members of the ZK ensemble.
:returns: A dictionary of (path, ClientInfo).
- 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 copy
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def copy(self, params, recursive, overwrite, max_items, mirror):
# default to zk://connected_host, if connected
src_connected_zk = dst_connected_zk = False
if self.connected:
zk_url = self._zk.zk_url()
- 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_path
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def write_path(self, path_value):
if isinstance(path_value, self.ZKPathValue):
acl = path_value.acl
else:
acl = [ACLReader.from_dict(a) for a in path_value.acl]
- 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 copy
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def copy(self, dst, recursive, max_items, mirror):
opname = "Copy" if not mirror else "Mirror"
# basic sanity check
if mirror and self.scheme == "zk" and dst.scheme == "file":
- 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 do_ephemeral_endpoint
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def do_ephemeral_endpoint(self, params):
"""
\x1b[1mNAME\x1b[0m
ephemeral_endpoint - Gets the ephemeral znode owner's session and ip:port
- 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 get
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get(self):
reqs = Queue()
pending = 0
path = self.path
zk = self.zk
- 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 do_grep
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def do_grep(self, path, match):
""" grep's work horse """
try:
children = self.get_children(path)
except (NoNodeError, NoAuthError):
- 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"