fbsamples / cp_reference
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 109 units with 1,467 lines of code in units (10.7% of code).
    • 1 very long units (124 lines of code)
    • 1 long units (59 lines of code)
    • 23 medium size units (633 lines of code)
    • 26 small units (363 lines of code)
    • 58 very small units (288 lines of code)
8% | 4% | 43% | 24% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py8% | 4% | 43% | 24% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
catalog31% | 0% | 25% | 22% | 20%
order0% | 9% | 41% | 31% | 17%
fb_metadata0% | 0% | 77% | 8% | 14%
shop0% | 0% | 58% | 23% | 17%
webhook0% | 0% | 96% | 0% | 3%
core0% | 0% | 46% | 0% | 53%
member0% | 0% | 0% | 100% | 0%
ROOT0% | 0% | 0% | 100% | 0%
config0% | 0% | 0% | 73% | 26%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def create_dummy_products()
in catalog/utils/dummy_products.py
124 2 1
def write_orders()
in order/utils/order_actions.py
59 10 2
def fetch_and_ack_orders()
in order/utils/order_actions.py
41 14 1
40 5 1
def fbe_callback()
in fb_metadata/views.py
37 6 1
def cancel_order()
in order/utils/order_actions.py
33 3 4
def createProduct()
in catalog/views.py
33 6 2
def fulfill_order()
in order/utils/order_actions.py
31 3 4
def generateFBEOnboardingURL()
in fb_metadata/utils/fbe.py
31 3 1
def getOrderItemsForOrder()
in order/utils/orders.py
29 2 1
def fbe()
in fb_metadata/views.py
29 7 2
28 2 1
def fulfillOrder()
in order/views.py
27 6 3
def getOrderObjInfo()
in order/utils/orders.py
26 2 1
def tokenSettings()
in fb_metadata/views.py
24 2 2
def get_reqd_headings_list()
in catalog/models/products.py
24 9 1
def webhooks()
in webhook/views.py
23 7 1
def process_list_order_response()
in order/utils/order_actions.py
23 6 1
def updateProduct()
in catalog/views.py
23 5 3
def updateStore()
in shop/views.py
23 6 2