Showing 186 of 349 total issues
Function transaction_history_queries
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def transaction_history_queries(request, user_or_pool):
# Web library native date format: 2015/06/19 19:00
# DO NOT CHANGE: The datetimepicker has a bug and tries to parse the
# prepopulated value before reading the format string,
# which means you have to use its native format string
- 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_inventory_submit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def admin_inventory_submit(request):
try:
items = {}
for key in request.POST:
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 admin_reimbursees_reimbursement_submit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def admin_reimbursees_reimbursement_submit(request):
try:
reimbursee = Reimbursee.from_id(int(request.POST['reimbursee']))
amount = Decimal(request.POST['amount'])
notes = request.POST['notes']
- 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 restock
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def restock(items, global_cost, donation, reimbursee, admin, timestamp=None, old_event_id=None):
e = event.Restock(admin, timestamp)
DBSession.add(e)
DBSession.flush()
t = transaction.Restock(e, Decimal(global_cost), 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 user_pool_addmember_submit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def user_pool_addmember_submit(request):
try:
pool = Pool.from_id(request.POST['pool-id'])
if pool.owner != request.user.id:
request.session.flash('You do not have permission to view that pool.', '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 create_x_y_from_group
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_x_y_from_group(group, start, end, period, process_output=lambda x: x, default=0):
x = []
y = []
if period == '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 restock
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def restock(items, global_cost, donation, reimbursee, admin, timestamp=None, old_event_id=None):
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 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
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, barcode, bottle_dep,
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):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, transaction, amount, item, quantity_predicted, quantity_counted, wholesale):
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, event, fr_acct_virt, to_acct_virt, fr_acct_cash, to_acct_cash, amount):
self.to_account_virt_id = to_acct_virt.id if to_acct_virt else None
self.fr_account_virt_id = fr_acct_virt.id if fr_acct_virt else None
self.to_account_cash_id = to_acct_cash.id if to_acct_cash else None
self.fr_account_cash_id = fr_acct_cash.id if fr_acct_cash else 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
Avoid deeply nested control flow statements. Open
for ss in s.subsubtransactions:
item = Item.from_id(ss.item_id)
item.in_stock -= ss.quantity
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
for line_item in transaction.subtransactions:
cap_search -= 1
if cap_search == 0:
return
if (line_item.item not in items) or allow_duplicates:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, event, user, amount, btctransaction, address, amount_btc):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, transaction, amount, item, quantity, price, wholesale):
Avoid deeply nested control flow statements. Open
if single_item_barcode_sub == single_barcode:
return True
return False
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, event, fr_acct_virt, to_acct_virt, fr_acct_cash, to_acct_cash, amount):