Showing 186 of 349 total issues
File views_admin.py
has 2793 lines of code (exceeds 250 allowed). Consider refactoring. Open
from pyramid.events import subscriber
from pyramid.events import BeforeRender
from pyramid.httpexceptions import HTTPFound
from pyramid.renderers import render
from pyramid.renderers import render_to_response
File transaction.py
has 851 lines of code (exceeds 250 allowed). Consider refactoring. Open
from .model import *
from . import account
from . import event
from . import item
from . import box
Function admin_items_list
has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring. Open
def admin_items_list(request):
group = request.GET['group'] if 'group' in request.GET else 'active'
if group == 'active':
page = 'active'
- 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_restock_submit
has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring. Open
def admin_restock_submit(request):
# Array of (Item, quantity, total) tuples
items_for_pricing = []
# Keep track of the total number of items being restocked. We use
- 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_submit
has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring. Open
def admin_box_edit_submit(request):
try:
box = Box.from_id(int(request.POST['box-id']))
if not box.exists_barcode(request.POST['box-barcode'], box.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
File chezbetty-terminal.js
has 564 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Chez Betty Main Terminal Javascript
*
*/
Function admin_item_edit
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def admin_item_edit(request):
try:
try:
purchase_limit = request.GET['purchase_limit']
if purchase_limit.lower() == '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
Function admin_item_edit_submit
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def admin_item_edit_submit(request):
try:
item = Item.from_id(int(request.POST['item-id']))
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 admin_box_add_submit
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def admin_box_add_submit(request):
try:
error = False
items_empty_barcode = 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
File views_data.py
has 478 lines of code (exceeds 250 allowed). Consider refactoring. Open
from pyramid.events import subscriber
from pyramid.events import BeforeRender
from pyramid.httpexceptions import HTTPFound
from pyramid.renderers import render
from pyramid.renderers import render_to_response
Function main
has 176 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main(global_config, **settings):
engine = engine_from_config(settings, 'sqlalchemy.')
Base.metadata.create_all(engine)
DBSession.configure(bind=engine)
Function iterate_recent_items
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def iterate_recent_items(self, limit=None, allow_duplicates=False, pictures_only=True):
cap_search = 20
items = set()
count = 0
for e in self.events:
- 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_btc_reconcile
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def admin_btc_reconcile(request):
try:
btc_balance = Bitcoin.get_balance()
btc = {"btc": btc_balance,
"usd": btc_balance * Bitcoin.get_spot_price()}
- 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
File datalayer.py
has 423 lines of code (exceeds 250 allowed). Consider refactoring. Open
import functools
from .models.model import *
from .models import event
from .models import transaction
Function create_version
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def create_version(obj, session, deleted=False):
obj_mapper = object_mapper(obj)
history_mapper = obj.__history_mapper__
history_cls = history_mapper.class_
- 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
File chezbetty-admin-onload.js
has 404 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Make the Demo Mode checkbox in the sidebar a pretty on/off slider
$(".admin-switch").bootstrapSwitch();
function ajax_bool (js_obj, object, field, id, state) {
Function undo_event
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def undo_event(e, user):
assert(can_undo_event(e))
line_items = {}
- 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
File views_user.py
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
from pyramid.events import subscriber
from pyramid.events import BeforeRender
from pyramid.httpexceptions import HTTPFound
from pyramid.renderers import render
from pyramid.renderers import render_to_response
Function datefilter_one_or_zero
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def datefilter_one_or_zero(label=None):
def wrap(fn_being_decorated):
@functools.wraps(fn_being_decorated)
def wrapped_fn(*args,
start=None, end=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
Function admin_items_add_submit
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def admin_items_add_submit(request):
error_items = []
# Iterate all the POST keys and find the ones that are item names
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"