Showing 5,781 of 10,536 total issues
Avoid deeply nested control flow statements. Open
Open
if has_sub_maximums_data_flag:
# line
line = LineChart()
line.title = _('Base Period Maximum Load') + ' / ' \
+ _('Reporting Period Maximum Load') + ' - ' \
Function generate_excel
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local, period_type, language):
Avoid deeply nested control flow statements. Open
Open
for j in range(len(line.series)):
line.series[j].marker.symbol = "circle"
line.series[j].smooth = True
line.x_axis.crosses = 'min'
Avoid deeply nested control flow statements. Open
Open
for j in range(0, ca_len):
current_col_number += 1
col = format_cell.get_column_letter(current_col_number)
ws[col + str(current_row_number)].font = title_font
Avoid deeply nested control flow statements. Open
Open
for j in range(0, ca_len):
current_col_number += 1
col = format_cell.get_column_letter(current_col_number)
ws[col + str(current_row_number)].font = title_font
Avoid deeply nested control flow statements. Open
Open
if has_sub_maximums_data_flag:
current_col_number += 1
col = format_cell.get_column_letter(current_col_number)
ws[col + str(current_row_number)].fill = table_fill
ws[col + str(current_row_number)].font = title_font
Function on_get
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def on_get(req, resp, id_):
"""Handles GET requests"""
admin_control(req)
if not id_.isdigit() or int(id_) <= 0:
raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
- 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
Open
for j in range(0, base_period_data_ca_len):
if has_sub_averages_data_flag:
current_col_number += 1
col = format_cell.get_column_letter(current_col_number)
Avoid deeply nested control flow statements. Open
Open
for j in range(0, reporting_period_data_ca_len):
current_col_number += 1
col = format_cell.get_column_letter(current_col_number)
ws[col + str(current_row_number)].font = title_font
Avoid deeply nested control flow statements. Open
Open
for j in range(0, ca_len):
current_col_number += 1
col = format_cell.get_column_letter(current_col_number)
ws[col + str(current_row_number)].font = title_font
Avoid deeply nested control flow statements. Open
Open
if sub_maximum is None:
sub_maximum = row[1]
elif sub_maximum < row[1]:
sub_maximum = row[1]
sub_counter += 1
Avoid deeply nested control flow statements. Open
Open
for j in range(len(line.series)):
line.series[j].marker.symbol = "circle"
line.series[j].smooth = True
line.x_axis.crosses = 'min'
Avoid deeply nested control flow statements. Open
Open
for j in range(0, base_period_data_ca_len):
current_col_number += 1
col = format_cell.get_column_letter(current_col_number)
ws[col + str(current_row_number)].font = title_font
Avoid deeply nested control flow statements. Open
Open
if sub_maximum is None:
sub_maximum = row[1]
elif sub_maximum < row[1]:
sub_maximum = row[1]
sub_counter += 1
Avoid deeply nested control flow statements. Open
Open
for j in range(0, reporting_period_data_ca_len):
if has_sub_averages_data_flag:
current_col_number += 1
col = format_cell.get_column_letter(current_col_number)
Avoid deeply nested control flow statements. Open
Open
for point in circuit['points']:
cursor.execute(" SELECT name "
" FROM tbl_points "
" WHERE id = %s ", (point['id'],))
if cursor.fetchone() is None:
Avoid deeply nested control flow statements. Open
Open
for j in range(0, ca_len):
current_col_number += 1
col = format_cell.get_column_letter(current_col_number)
ws[col + str(current_row_number)].font = title_font
Avoid deeply nested control flow statements. Open
Open
for j in range(len(line.series)):
line.series[j].marker.symbol = "circle"
line.series[j].smooth = True
line.x_axis.crosses = 'min'
Avoid deeply nested control flow statements. Open
Open
if has_sub_averages_data_flag:
ws[col + str(current_row_number)].font = title_font
ws[col + str(current_row_number)].alignment = c_c_alignment
ws[col + str(current_row_number)].border = f_border
ws[col + str(current_row_number)] = round2(reporting_period_data['sub_averages'][j][i], 2) \
Avoid deeply nested control flow statements. Open
Open
for j in range(0, ca_len):
current_col_number += 1
col = format_cell.get_column_letter(current_col_number)
ws[col + str(current_row_number)].font = title_font