Showing 186 of 349 total issues
Consider simplifying this complex logical expression. Open
if e.type != 'deposit' and e.type != 'purchase' and e.type != 'restock' \
and e.type != 'inventory' and e.type != 'emptycashbox' \
and e.type != 'emptysafe' \
and e.type != 'donation' and e.type != 'withdrawal' \
and e.type != 'reimbursement' \
Function user_dayssincepurchase_histogram
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def user_dayssincepurchase_histogram ():
bin_size = 10 # days
bins = {}
def to_bin (x):
- 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_item_search_json
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def admin_item_search_json(request):
try:
boxes = Box.from_fuzzy(request.matchdict['search'])
items = Item.from_fuzzy(request.matchdict['search'])
box_vendors = BoxVendor.from_number_fuzzy(request.matchdict['search'])
- 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_item_barcode_pdf
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def admin_item_barcode_pdf(request):
try:
item = Item.from_id(request.matchdict['item_id'])
fname = '/tmp/{}.pdf'.format(item.id)
- 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 exists_barcode
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def exists_barcode(cls, barcode, id=None):
#split string into individual barcodes
barcode_list = barcode.split(';')
for single_barcode in barcode_list:
if single_barcode != "":
- 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_users_email_debt
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def admin_users_email_debt(request):
email_type = request.matchdict['type']
if email_type == 'deadbeats':
deadbeats = User.get_deadbeats()
- 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 exists_barcode
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def exists_barcode(cls, barcode, id=None):
#split string into individual barcodes
barcode_list = barcode.split(';')
for single_barcode in barcode_list:
if single_barcode != "":
- 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 terminal_deposit
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def terminal_deposit(request):
try:
if request.POST['umid'] == '':
# User was not logged in when deposit was made. We store
# this deposit temporarily and give it to the next user who
- 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 search_item_only_success
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function search_item_only_success (data, context, one_item_fn) {
alert_clear();
$("#" + context + "-notice-item").text("");
$("." + context + "-item-addedrows").remove();
- 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_cash_reconcile_submit
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def admin_cash_reconcile_submit(request):
try:
if request.POST['cash-box-reconcile-type'] == 'cashboxtosafe':
if account.get_cash_account("cashbox").balance == Decimal('0'):
- 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_box_edit
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def admin_box_edit(request):
try:
box = Box.from_id(request.matchdict['box_id'])
items = Item.all_force()
- 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 search_item_success
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function search_item_success (data) {
alert_clear();
$("#restock-search-notice").text("");
$(".restock-search-addedrows").remove();
- 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 calculate_total
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function calculate_total () {
total = 0;
$("#purchase-table tr.purchase-item").each(function (index) {
if ($(this).attr('id') != "purchase-empty") {
line_total = parseFloat(
Function limitable_all
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def limitable_all(fn_wrapped_by_limitable_all):
@functools.wraps(fn_wrapped_by_limitable_all)
def limitable_all_wrapper(*args, limit=None, offset=None, count=False, **kwargs):
q = fn_wrapped_by_limitable_all(*args, **kwargs)
if offset:
- 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_item_barcode_json
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def admin_item_barcode_json(request):
try:
item = Item.from_barcode(request.matchdict['barcode'])
html = render('templates/admin/restock_row.jinja2', {'item': item, 'line': {}})
return {'status': 'success',
- 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 process_input
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function process_input () {
// Keep a local copy so we can clear global in case anything goes wrong.
var keyin = keyboard_input;
keyboard_input = '';
- 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 wrapped_fn
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def wrapped_fn(*args,
Function submit_purchase
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function submit_purchase (this_btn, success_cb, error_cb) {
purchase_alert_clear();
if (this_btn != null) {
$(this_btn).blur();
Function terminal_purchase
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def terminal_purchase(request):
try:
user = User.from_umid(request.POST['umid'])
ignored_keys = ['umid', 'pool_id']
- 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 search_user_success
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function search_user_success (data, prefix) {
alert_clear();
$("#"+prefix+"-notice").text("");
$("."+prefix+"-addedrows").remove();
- 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"