Showing 186 of 349 total issues
Function user_numberofpurchases_histogram
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def user_numberofpurchases_histogram ():
bins = {}
users = User.get_normal_users()
for user in users:
- 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 deposit
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def deposit(user, account, amount, merge=True):
assert(amount > 0.0)
assert(hasattr(user, "id"))
# Keep track of how much this deposit will be once merged (if needed)
- 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_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 timeseries_balance_total_daily
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def timeseries_balance_total_daily(rows):
# Is debt going away or coming in
directions = {
'purchase': -1, # user balance goes down by amount
- 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_purchasers
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def admin_users_email_purchasers(request):
# Group all of the items into the correct structure
items = []
for key,value in request.POST.items():
if key == '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 search_item_success
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function search_item_success (data) {
alert_clear();
$("#restock-search-notice").text("");
$(".restock-search-addedrows").remove();
Function search_item_only_success
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function search_item_only_success (data, context, one_item_fn) {
alert_clear();
$("#" + context + "-notice-item").text("");
$("." + context + "-item-addedrows").remove();
Function limitable_request
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def limitable_request(request, fn, prefix=None, limit=None, count=False):
if prefix:
limit_str = prefix + '_limit'
offset_str = prefix + '_offset'
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 create_json
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create_json(request, metric, period):
try:
if 'days' in request.GET:
num_days = int(request.GET['days'])
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_event_undo
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def admin_event_undo(request):
try:
# Lookup the transaction that the user wants to undo
event = Event.from_id(request.matchdict['event_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 calculate_total
has a Cognitive Complexity of 10 (exceeds 5 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(
- 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 check_submit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
$('.form-with-requirements').submit(function check_submit(evt) {
evt.preventDefault();
var missing_requirements = [];
$('.form-required').each(function check_submit_each(index) {
- 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_deposit_cc_submit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def user_deposit_cc_submit(request):
token = request.POST['stripeToken']
amount = Decimal(request.POST['betty_amount'])
total_cents = int(request.POST['betty_total_cents'])
to_account = request.POST['betty_to_account']
- 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_announcements_edit_submit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def admin_announcements_edit_submit(request):
# Group all the form items into a nice dict that we can cleanly iterate
announcements = {}
for key in request.POST:
- 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_wallofshame_fee_percent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function calculate_wallofshame_fee_percent (balance, total) {
// If not on wall of shame, nor going to be, no fee
if (balance - total > -5.0) return 0.0;
// Calculate the correct fee.
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, barcode, price, wholesale, bottle_dep, sales_tax,
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function post_stripe_payment
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def post_stripe_payment(
Function add_item_success
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function add_item_success (data) {
purchase_alert_clear();
if ("error" in data) {
purchase_alert_error(data.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"