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 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 wrapped_fn
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def wrapped_fn(*args,
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,
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
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
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):
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):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, transaction, amount, item_id, quantity, wholesale):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, event, user, amount, stripe_id, last4):
Function __get_events_by_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __get_events_by_type(cls, event_type):
q = DBSession.query(event.Event)\
.join(Transaction)
if event_type == 'cash':
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, event, user, amount):
cashbox_c = account.get_cash_account("cashbox")
prev = cashbox_c.balance
Transaction.__init__(self, event, None, user, None, cashbox_c, amount)
new = cashbox_c.balance
- 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"