Showing 14 of 31 total issues
Function send_action
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def send_action(self, name, *args):
logger.debug('Sending %s action to workers: %s', name, ', '.join(self.workers))
data = {'action': name, 'args': 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 _matching
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _matching(self, target):
for matching_resource in super(TaskList, self)._matching(target):
yield matching_resource
for task in self:
- 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 process_ingress
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def process_ingress(self):
virtual_ips = self.raw.attrs['Endpoint'].get('VirtualIPs', list())
# for older API versions
probably_ingress = 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
Function _matching
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _matching(self, target):
for matching_resource in super(ContainerList, self)._matching(target):
yield matching_resource
for container in self:
- 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 _matching
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _matching(self, target):
if isinstance(target, six.string_types):
for resource in self:
if resource.id == target or resource.name == target:
yield resource
- 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 process_networks
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def process_networks(self):
virtual_ips = self.raw.attrs['Endpoint'].get('VirtualIPs', list())
raw_network_ids = set()
raw_network_ids.update(
- 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 a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, **kwargs):
self.target_path = kwargs.get('target')
self.template_source = kwargs.get('template')
self.restart_targets = kwargs.get('restart', self.EMPTY_LIST)
self.signal_targets = kwargs.get('signal', self.EMPTY_LIST)
- 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 _process
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _process(self, target):
found_services = 0
for service in self.matching_services(target):
try:
- 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 _matching
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _matching(self, target):
for matching_resource in super(NetworkList, self)._matching(target):
yield matching_resource
if isinstance(target, NetworkList):
- 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 execute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def execute(self, *args):
try:
if self.manager:
if self.execution_strategy & ExecutionStrategy.WORKER:
logger.debug('Executing %s action on workers', self.action_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 __getattr__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __getattr__(self, item):
if item in self:
return self[item]
elif hasattr(item, 'lower'):
- 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
Consider simplifying this complex logical expression. Open
if resource.id == target or resource.name == target:
yield resource
elif hasattr(resource, 'labels') and resource.labels and target == resource.labels.get('pygen.target'):
yield resource
Function _matching
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _matching(self, target):
for matching_resource in super(ServiceList, self)._matching(target):
yield matching_resource
for service in self:
- 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 send_update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def send_update(self, status):
for manager in self.managers:
for _ in range(self.retries + 1):
try:
response = requests.post('http://%s:%d/' % (manager, self.manager_port), timeout=(5, 30))
- 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"