microsoft / pai
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 2,692 units with 25,564 lines of code in units (34.0% of code).
    • 3 very long units (704 lines of code)
    • 40 long units (2,616 lines of code)
    • 250 medium size units (7,446 lines of code)
    • 412 small units (5,985 lines of code)
    • 1,987 very small units (8,813 lines of code)
2% | 10% | 29% | 23% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js8% | 9% | 36% | 19% | 25%
java2% | 10% | 19% | 21% | 46%
py0% | 8% | 33% | 28% | 29%
go0% | 35% | 30% | 11% | 22%
tsx0% | 39% | 42% | 10% | 7%
rb0% | 0% | 37% | 47% | 14%
ts0% | 0% | 72% | 0% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/database-controller20% | 18% | 20% | 22% | 17%
subprojects/frameworklauncher2% | 10% | 19% | 21% | 46%
src/rest-server10% | 0% | 41% | 15% | 31%
contrib/profiler0% | 58% | 5% | 18% | 17%
src/webportal0% | 8% | 43% | 22% | 25%
src/watchdog0% | 35% | 30% | 11% | 22%
src/job-exporter0% | 11% | 30% | 35% | 23%
src/alert-manager0% | 35% | 27% | 15% | 20%
contrib/aks-engine0% | 29% | 33% | 16% | 20%
deployment0% | 13% | 34% | 24% | 28%
contrib/submit-job-v20% | 31% | 48% | 8% | 11%
contrib/kubespray0% | 9% | 56% | 20% | 13%
deployment/k8sPaiLibrary0% | 0% | 44% | 34% | 21%
deployment/paiLibrary0% | 0% | 39% | 21% | 38%
deployment/clusterObjectModel0% | 0% | 54% | 32% | 12%
deployment/utility0% | 0% | 61% | 0% | 38%
src/fluentd0% | 0% | 35% | 45% | 18%
contrib/remote-dev-tool0% | 0% | 31% | 43% | 24%
build/core0% | 0% | 26% | 33% | 39%
deployment/confStorage0% | 0% | 12% | 34% | 52%
build0% | 0% | 80% | 0% | 19%
contrib/debug-tools0% | 0% | 35% | 28% | 36%
build/model0% | 0% | 28% | 30% | 40%
ROOT0% | 0% | 87% | 0% | 12%
src/authentication0% | 0% | 32% | 47% | 20%
src/utilities0% | 0% | 31% | 40% | 27%
src/pylon0% | 0% | 48% | 31% | 20%
src/cluster0% | 0% | 0% | 74% | 25%
contrib/autoscaler0% | 0% | 0% | 33% | 66%
contrib/hived-config-adapter0% | 0% | 0% | 56% | 43%
src/prometheus-pushgateway0% | 0% | 0% | 48% | 51%
contrib/api-stress-test0% | 0% | 0% | 31% | 68%
src/k8s-dashboard0% | 0% | 0% | 70% | 30%
src/base-image0% | 0% | 0% | 40% | 59%
src/device-plugin0% | 0% | 0% | 46% | 53%
src/internal-storage0% | 0% | 0% | 35% | 64%
src/postgresql0% | 0% | 0% | 0% | 100%
src/grafana0% | 0% | 0% | 0% | 100%
src/prometheus0% | 0% | 0% | 0% | 100%
src/hivedscheduler0% | 0% | 0% | 0% | 100%
src/marketplace-restserver0% | 0% | 0% | 0% | 100%
src/marketplace-db0% | 0% | 0% | 0% | 100%
src/marketplace-webportal0% | 0% | 0% | 0% | 100%
src/docker-cache0% | 0% | 0% | 0% | 100%
src/dshuttle0% | 0% | 0% | 0% | 100%
src/log-manager0% | 0% | 0% | 0% | 100%
src/node-exporter0% | 0% | 0% | 0% | 100%
src/storage-manager0% | 0% | 0% | 0% | 100%
src/k8s-job-exit-spec0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in src/database-controller/sdk/index.js
328 1 2
static
in subprojects/frameworklauncher/yarn/src/main/java/com/microsoft/frameworklauncher/common/exit/FrameworkExitSpec.java
191 1 0
name: convertName()
in src/rest-server/src/models/v2/job/k8s.js
185 3 1
public synchronized void transitionTaskState()
in subprojects/frameworklauncher/yarn/src/main/java/com/microsoft/frameworklauncher/applicationmaster/StatusManager.java
92 27 3
def detect_pattern()
in contrib/profiler/utils.py
88 50 2
getPaiCommand()
in src/webportal/src/app/job-submission/models/data/mount-directories.js
88 20 0
private void attemptToRetry()
in subprojects/frameworklauncher/yarn/src/main/java/com/microsoft/frameworklauncher/service/Service.java
88 16 1
def draw_graph()
in contrib/profiler/profiler.py
83 13 4
def parse_smi_xml_result()
in src/job-exporter/src/nvidia.py
82 21 1
private Set resyncTasksWithLiveContainers()
in subprojects/frameworklauncher/yarn/src/main/java/com/microsoft/frameworklauncher/applicationmaster/ApplicationMaster.java
81 11 1
def get_k8s_cluster_info()
in contrib/aks-engine/azure.py
77 17 3
generatePreMountCmds()
in src/webportal/src/app/job-submission/models/data/mount-directories.js
75 9 2
func()
in src/watchdog/src/pkg/watchdog/metric_generator.go
74 14 1
private void attemptToRetry()
in subprojects/frameworklauncher/yarn/src/main/java/com/microsoft/frameworklauncher/applicationmaster/ApplicationMaster.java
74 15 1
public synchronized void transitionFrameworkState()
in subprojects/frameworklauncher/yarn/src/main/java/com/microsoft/frameworklauncher/service/StatusManager.java
73 19 3
def generate_configuration()
in deployment/configCmd.py
72 12 3
generateMountCmds()
in src/webportal/src/app/job-submission/models/data/mount-directories.js
71 12 4
private void resyncFrameworksWithLiveApplications()
in subprojects/frameworklauncher/yarn/src/main/java/com/microsoft/frameworklauncher/service/Service.java
71 16 1
def analyze_value()
in contrib/profiler/profiler.py
69 14 3
async create()
in src/database-controller/src/common/framework.js
67 21 0