datawinners/custom_reports/crs/test_data.py
File test_data.py
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
from datetime import date
import random
import string
from dateutil.relativedelta import relativedelta
from datawinners.custom_reports.crs.models import ContainerSent, PackingList, BillOfLading, BreakBulkSent, WayBillReceivedPort, WayBillSent, WayBillReceived, Distribution, BAV, NumberOfRecipientServed, PhysicalInventorySheet, Warehouse, SiteActivities
Function build
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def build(self, store_house_code, year, month, food, pl_code):
Function return_remaining
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def return_remaining(distribution, distribution_shipping_date, food_type, pl_code, way_bill_received):
Function build
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def build(self,pl_code,sent_date,source_warehouse,food_type,waybill_code=None):
Function build_sent_to_site
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def build_sent_to_site(self, pl_code, sent_date, source_warehouse, food_type,way_bill_code=None):
Function physical_inventory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def physical_inventory(year, commodities):
for warehouse in Warehouse.objects.all():
for food in commodities:
for pl in PackingList.objects.all():
PhysicalInventorySheetBuilder().build(warehouse.q5, year, 6, food, pl.q1).save()
- 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"