mangroveorg/datawinners

View on GitHub
datawinners/custom_reports/crs/test_data.py

Summary

Maintainability
B
5 hrs
Test Coverage

File test_data.py has 264 lines of code (exceeds 250 allowed). Consider refactoring.
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
Severity: Minor
Found in datawinners/custom_reports/crs/test_data.py - About 2 hrs to fix

    Function build has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def build(self, store_house_code, year, month, food, pl_code):
    Severity: Minor
    Found in datawinners/custom_reports/crs/test_data.py - About 35 mins to fix

      Function return_remaining has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def return_remaining(distribution, distribution_shipping_date, food_type, pl_code, way_bill_received):
      Severity: Minor
      Found in datawinners/custom_reports/crs/test_data.py - About 35 mins to fix

        Function build has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def build(self,pl_code,sent_date,source_warehouse,food_type,waybill_code=None):
        Severity: Minor
        Found in datawinners/custom_reports/crs/test_data.py - About 35 mins to fix

          Function build_sent_to_site has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def build_sent_to_site(self, pl_code, sent_date, source_warehouse, food_type,way_bill_code=None):
          Severity: Minor
          Found in datawinners/custom_reports/crs/test_data.py - About 35 mins to fix

            Function physical_inventory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            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()
            Severity: Minor
            Found in datawinners/custom_reports/crs/test_data.py - About 25 mins to fix

            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

            There are no issues that match your filters.

            Category
            Status