Showing 154 of 497 total issues
Function eval_factor
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def eval_factor(factor_id, var_samp, value, var_copy, variable, factor, fmap,
Function run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
"""Start the load balancer."""
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
_set_tcp_keepalive(self._socket, self.opts)
- 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 learn
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def learn(self, burnin_epochs, epochs, stepsize, decay, regularization,
reg_param, truncation, diagnostics=False, verbose=False,
learn_non_evidence=False, var_copy=0, weight_copy=0):
"""TODO."""
# Burn-in
- 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 compute_var_map
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def compute_var_map(variables, factors, fmap, vmap, factor_index, domain_mask,
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, application_dir, machines,
Function load_factors
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def load_factors(data, nfactors, factors, fmap, domain_mask, variable, vmap):
Function handle_stream
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handle_stream(self, stream, address):
"""Handle incoming streams and add messages to the incoming queue."""
self.log.debug('InfLearn client {0} connected'.format(address))
self.clients.append((stream, address))
unpacker = msgpack.Unpacker()
- 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 inference
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def inference(self, burnin_epochs, epochs, sample_evidence=False,
Avoid deeply nested control flow statements. Open
if tcp_keepalive_idle > 0:
sock.setsockopt(
socket.SOL_TCP, socket.TCP_KEEPIDLE,
int(tcp_keepalive_idle))
if hasattr(socket, 'TCP_KEEPCNT'):
Avoid deeply nested control flow statements. Open
if tcp_keepalive_intvl > 0:
sock.setsockopt(
socket.SOL_TCP, socket.TCP_KEEPINTVL,
int(tcp_keepalive_intvl))
if hasattr(socket, 'SIO_KEEPALIVE_VALS'):
Function __bind
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __bind(self):
"""TODO."""
if self.log_queue is not None:
salt.log.setup.set_multiprocessing_logging_queue(self.log_queue)
salt.log.setup.setup_multiprocessing_logging(self.log_queue)
- 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 compute_pf_values
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def compute_pf_values(factor, fmap, var_value, variable, pf_list, pf):
Avoid deeply nested control flow statements. Open
if tcp_keepalive_cnt > 0:
sock.setsockopt(
socket.SOL_TCP, socket.TCP_KEEPCNT,
int(tcp_keepalive_cnt))
if hasattr(socket, 'TCP_KEEPINTVL'):
Function apply_pf_values
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def apply_pf_values(factor, fmap, var_value, variable, pf_list, pf_values):
Function dump_probabilities
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dump_probabilities(self, fout, epochs):
"""Dump <vid, value, prob> text file in DW format."""
epochs = epochs or 1
with open(fout, 'w') as out:
for i, v in enumerate(self.variable):
- 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
Avoid deeply nested control flow statements. Open
if tcp_keepalive_intvl <= 0:
tcp_keepalive_intvl = 1
# The values expected are in milliseconds, so multiply by
# 1000.
sock.ioctl(socket.SIO_KEEPALIVE_VALS, (
Function skip
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def skip(app, what, name, obj, skip, options):
Avoid deeply nested control flow statements. Open
if tcp_keepalive_idle <= 0:
tcp_keepalive_idle = 7200
if tcp_keepalive_intvl <= 0:
Function get_variables_helper
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_variables_helper(row, vid, variable, var_pt, var_ufo, index):
Function inference
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def inference(self, burnin_epochs, epochs, sample_evidence=False,
diagnostics=False, var_copy=0, weight_copy=0):
"""TODO."""
# Burn-in
if burnin_epochs > 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"