aws / telegraf
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 5,215 units with 104,171 lines of code in units (76.0% of code).
    • 54 very long units (36,299 lines of code)
    • 211 long units (14,265 lines of code)
    • 811 medium size units (25,261 lines of code)
    • 935 small units (13,983 lines of code)
    • 3,204 very small units (14,363 lines of code)
34% | 13% | 24% | 13% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go34% | 13% | 24% | 13% | 13%
py42% | 15% | 11% | 13% | 17%
c0% | 0% | 36% | 50% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
plugins40% | 12% | 23% | 11% | 11%
patches5% | 21% | 28% | 17% | 26%
scripts42% | 15% | 11% | 13% | 17%
cmd33% | 20% | 23% | 10% | 11%
agent0% | 27% | 21% | 30% | 20%
metric0% | 22% | 5% | 22% | 48%
config0% | 23% | 28% | 25% | 23%
testutil0% | 8% | 3% | 46% | 41%
models0% | 5% | 47% | 16% | 30%
internal0% | 4% | 31% | 37% | 26%
logger0% | 0% | 41% | 26% | 31%
selfstat0% | 0% | 18% | 39% | 42%
filter0% | 0% | 0% | 70% | 29%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in plugins/parsers/influx/machine.go
28385 10050 1
func PullRequestReviewCommentEventJSON()
in plugins/inputs/webhooks/github/github_webhooks_mock_json.go
448 1 0
func NewStatLine()
in plugins/inputs/mongodb/mongostat.go
427 104 5
func PullRequestEventJSON()
in plugins/inputs/webhooks/github/github_webhooks_mock_json.go
414 1 0
func getMetrics()
in plugins/inputs/mesos/mesos.go
222 4 2
func StatusEventJSON()
in plugins/inputs/webhooks/github/github_webhooks_mock_json.go
207 1 0
func ForkEventJSON()
in plugins/inputs/webhooks/github/github_webhooks_mock_json.go
198 1 0
func IssueCommentEventJSON()
in plugins/inputs/webhooks/github/github_webhooks_mock_json.go
184 1 0
func()
in plugins/inputs/tengine/tengine.go
176 37 1
func DeploymentStatusEventJSON()
in plugins/inputs/webhooks/github/github_webhooks_mock_json.go
175 1 0
func()
in patches/gopsutil/process/process_linux.go
167 50 1
func()
in plugins/parsers/grok/parser.go
160 46 1
func PushEventJSON()
in plugins/inputs/webhooks/github/github_webhooks_mock_json.go
159 1 0
func()
in plugins/outputs/prometheus_client/v1/collector.go
158 37 1
func IssuesEventJSON()
in plugins/inputs/webhooks/github/github_webhooks_mock_json.go
156 1 0
func parseContainerStats()
in plugins/inputs/docker/docker.go
154 19 7
func ReleaseEventJSON()
in plugins/inputs/webhooks/github/github_webhooks_mock_json.go
149 1 0
func DeploymentEventJSON()
in plugins/inputs/webhooks/github/github_webhooks_mock_json.go
144 1 0
func CommitCommentEventJSON()
in plugins/inputs/webhooks/github/github_webhooks_mock_json.go
142 1 0
func PageBuildEventJSON()
in plugins/inputs/webhooks/github/github_webhooks_mock_json.go
141 1 0