awslabs / smithy-rs
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 1,468 units with 17,104 lines of code in units (33.0% of code).
    • 2 very long units (256 lines of code)
    • 19 long units (1,177 lines of code)
    • 197 medium size units (5,812 lines of code)
    • 322 small units (4,827 lines of code)
    • 928 very small units (5,032 lines of code)
1% | 6% | 33% | 28% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
kt5% | 9% | 36% | 25% | 23%
rs0% | 5% | 32% | 29% | 32%
ts0% | 51% | 32% | 10% | 5%
kts0% | 0% | 72% | 7% | 19%
py0% | 0% | 22% | 58% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
codegen7% | 10% | 35% | 23% | 22%
rust-runtime0% | 6% | 28% | 28% | 36%
tools0% | 15% | 34% | 31% | 18%
aws0% | 2% | 37% | 29% | 31%
codegen-server0% | 0% | 44% | 33% | 21%
codegen-server-test0% | 0% | 77% | 0% | 22%
codegen-test0% | 0% | 77% | 0% | 22%
buildSrc0% | 0% | 0% | 87% | 12%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
fun render()
in codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/error/CombinedErrorGenerator.kt
131 5 1
override fun section()
in codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/FluentClientDecorator.kt
125 9 1
constructor()
in tools/ci-cdk/lib/aws-sdk-rust/canary-stack.ts
88 1 3
fn call()
in rust-runtime/aws-smithy-client/src/dvr/replay.rs
77 5 2
fn sync_aws_sdk_with_smithy_rs()
in tools/smithy-rs-sync/src/main.rs
71 7 5
fun parseError()
in codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/protocols/HttpBoundProtocolGenerator.kt
70 4 1
fn parse_imf_fixdate()
in rust-runtime/aws-smithy-types/src/date_time/format.rs
69 8 1
fun renderOperation()
in codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/protocol/ProtocolGenerator.kt
65 6 4
fn test_expect_document()
in rust-runtime/aws-smithy-json/src/deserialize/token.rs
64 1 0
fn test_fix_dep_sets()
in tools/publisher/src/subcommand/fix_manifests.rs
63 1 0
fn render()
in tools/sdk-lints/src/changelog.rs
61 11 3
fn record_body()
in rust-runtime/aws-smithy-client/src/dvr/record.rs
61 5 4
fn end_to_end_changelog()
in tools/sdk-lints/src/changelog.rs
57 2 0
fun render()
in aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt
57 4 1
fun structMember()
in codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/protocols/serialize/QuerySerializerGenerator.kt
56 1 3
fun render()
in codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/Instantiator.kt
56 3 6
fun render()
in codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/ServiceConfigGenerator.kt
54 1 1
fun structMember()
in codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/protocols/serialize/JsonSerializerGenerator.kt
53 1 4
fn call()
in rust-runtime/aws-smithy-client/src/dvr/record.rs
53 3 2
fn test_sign_headers_space_trimming()
in aws/rust-runtime/aws-sigv4/src/http_request/sign.rs
51 1 0