Showing 31 of 35 total issues
Function find_package_data
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def find_package_data(where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
- 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 setup.py
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import distutils
import filecmp
import getpass
Function set_default_subparser
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def set_default_subparser(self, name, args=None):
"""default subparser selection. Call after setup, just before parse_args()
name: is the name of the subparser to call by default
args: if set is the argument list handed to parse_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
File lines.py
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
import re
import string
import sys
import six
Function run
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
print('Starting Python module installation.')
self.do_egg_install()
print('-' * 80)
if getpass.getuser() != 'root':
- 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_process
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _execute_process(self, env):
lines = []
popen = subprocess.Popen([self.script_path], stdout=subprocess.PIPE, env=env)
l = self.get_timer(popen)
- 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 pprint_list
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def pprint_list(input_list, terminal_size=None):
# http://stackoverflow.com/questions/25026556/output-list-like-ls
term_width, term_height = terminal_size or get_terminal_size()
if len(str(input_list)) <= term_width:
print(input_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 send
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def send(self, subject, message, observable_name='', name='', extra_info=None, level='warning', fail=True,
Function send
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def send(self, subject, message, observable_name='', name='', extra_info=None, level='warning', fail=True,
Function parse_lines
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse_lines(self, lines, on_error=InvalidScriptLineLogging):
for i, line in enumerate(lines):
try:
yield RawLine.parse(line, self)
except InvalidScriptLineError:
- 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_prints
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_prints(auth=None):
auth = auth or Auth()
r = None
for i in range(2):
r = requests.get(SEARCH_PRINTS, auth=auth)
- 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_alerts
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def send_alerts(self, observable, fail=True):
communication = ObservableCommunication(observable, fail)
for alert in self:
seconds = observable.get_line_value('seconds', 0)
since = self.sma.results.get_observable_result(observable).get('since')
- 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 (fnmatchcase(name, pattern)
or fn.lower() == pattern.lower()):
bad_name = True
if show_ignored:
sys.stderr.write(
Function find_package_data
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_package_data(where='.', package='',
Function log_evaluate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def log_evaluate(observable, result=None, use_logger=True):
from simple_monitor_alert.utils.system import get_hostname
result = result or observable.evaluate()
level = 'success' if result else observable.get_line_value('level') or 'warning'
msg = '{} - - Trigger: [{}] ({}) {}. '.format(get_hostname(), level,
- 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 (fnmatchcase(name, pattern)
or fn.lower() == pattern.lower()):
bad_name = True
if show_ignored:
sys.stderr.write(
Function get_alerts_config
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_alerts_config(self):
for section in self.config.sections():
if self.config.has_option(section, 'alert'):
alert = self.config.get(section, 'alert')
if alert not in self.valid_alerts:
- 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 not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
Function send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send(self, subject, message, observable=None, result=None, **kwargs):
Function _sma_observable
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _sma_observable(observable_name, expected, function=None, param=None, value=None):