Showing 186 of 349 total issues
Function admin_data_period_range
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def admin_data_period_range(start, end, metric, period):
if metric == 'items':
data = PurchaseLineItem.quantity_by_period(period, start=ftz(start), end=ftz(end))
return zip(create_x_y_from_group(data, start, end, period))
elif metric == 'sales':
- 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_highcharts_json
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_highcharts_json(request, metric, period):
try:
return admin_data_highcharts_period(metric, period)
except ValueError:
return {'status': 'error'}
- 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 from_barcode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def from_barcode(cls, barcode):
item_list = DBSession.query(cls).filter(cls.barcode.ilike('%{}%'.format(barcode))).all()
for item in item_list:
#split string into individual barcodes
item_barcode_sub = item.barcode.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
Function admin_index_history_semesters
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def admin_index_history_semesters(request):
semester = request.matchdict['semester']
year_start = 2014
year_end = arrow.now().year
- 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_event_filter_function
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _get_event_filter_function(event_filter):
fields = event_filter.split(':')
if fields[0] == 'type':
def filterfn (*args, **kwargs):
return Event.get_events_by_type(fields[1], *args, **kwargs)
- 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 readGitVersion
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def readGitVersion():
try:
proc = subprocess.Popen(('git', 'describe', '--long', '--tags',
'--match', 'v[0-9]*.*'),
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- 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"