Showing 186 of 349 total issues
Function admin_boxes_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def admin_boxes_list(request):
unpopulated_boxes = []
active_populated = []
inactive_populated = []
- 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
for line_item in t.subtransactions:
wholesale += line_item.wholesale
sheet.write_number(row, 3, wholesale, money_format)
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, barcode, bottle_dep,
Function create_x_y_from_group
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_x_y_from_group(group, start, end, period, process_output=lambda x: x, default=0):
Function user_purchase_add_item_success
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function user_purchase_add_item_success (data) {
if (data.status != "success") {
if (data.status == "unknown_barcode") {
alert_error("Could not find that item.");
} else {
- 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 update_amount
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_amount(self, amount):
# Remove the balance we added before (upon init or last update_amount)
if self.to_acct_virt:
self.to_acct_virt.balance -= self.amount
if self.fr_acct_virt:
- 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 p.foreign_keys:
obj_changed = True
break
if obj_changed is True:
Function create_x_y_from_group_each
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_x_y_from_group_each(group, mapping, start, end, process_output=lambda x: x, default=0):
Avoid deeply nested control flow statements. Open
if item_num == '':
vendoritem.enabled = False
else:
vendoritem.item_number = item_num
break
Function admin_cash_adjustment_submit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def admin_cash_adjustment_submit(request):
try:
amount = Decimal(request.POST['amount'])
# Look for custom date
- 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 quantity != '':
# Add a new vendor to the item
item = Item.from_id(item_id)
box_item = BoxItem(box, item, quantity, round(Decimal(percentage), 2))
DBSession.add(box_item)
Avoid deeply nested control flow statements. Open
if item_num != '':
# Add a new vendor to the item
vendor = Vendor.from_id(vendor_id)
box_vendor = BoxVendor(vendor, box, item_num)
DBSession.add(box_vendor)
Avoid deeply nested control flow statements. Open
if boxitem.item_id == item_id and boxitem.enabled:
if quantity == '' or int(quantity) == 0:
boxitem.enabled = False
else:
boxitem.quantity = int(quantity)
Function admin_cash_donation_submit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def admin_cash_donation_submit(request):
try:
amount = Decimal(request.POST['amount'])
# Look for custom date
- 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 vendorbox.vendor_id == vendor_id and vendorbox.enabled:
if item_num == '':
vendorbox.enabled = False
else:
vendorbox.item_number = item_num
Avoid deeply nested control flow statements. Open
if output['addr'] in addrs and output['type'] == 0:
addr = output['addr']
amount += Decimal(output['value'])
Function admin_cash_withdrawal_submit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def admin_cash_withdrawal_submit(request):
try:
amount = Decimal(request.POST['amount'])
reimbursee = Reimbursee.from_id(int(request.POST['reimbursee']))
- 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 cc_deposit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def cc_deposit(user, account, amount, txn_id, last4):
Function ajax_button_textlike
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function ajax_button_textlike (js_obj, object, field, id, value) {
Function ajax_bool
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function ajax_bool (js_obj, object, field, id, state) {