awslabs / smithy
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,955 units with 38,190 lines of code in units (69.8% of code).
    • 3 very long units (409 lines of code)
    • 19 long units (1,316 lines of code)
    • 259 medium size units (7,117 lines of code)
    • 611 small units (8,774 lines of code)
    • 5,063 very small units (20,574 lines of code)
1% | 3% | 18% | 22% | 53%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
java1% | 3% | 18% | 22% | 53%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
smithy-openapi4% | 3% | 16% | 17% | 58%
smithy-aws-apigateway-openapi13% | 0% | 32% | 29% | 24%
smithy-utils6% | 4% | 19% | 25% | 43%
smithy-model0% | 3% | 18% | 24% | 53%
smithy-jmespath0% | 10% | 18% | 25% | 45%
smithy-jsonschema0% | 11% | 20% | 11% | 57%
smithy-cli0% | 5% | 25% | 19% | 49%
smithy-aws-traits0% | 3% | 20% | 22% | 54%
smithy-build0% | 0% | 16% | 19% | 64%
smithy-diff0% | 0% | 28% | 34% | 37%
smithy-aws-cloudformation0% | 0% | 18% | 25% | 56%
smithy-aws-cloudformation-traits0% | 0% | 27% | 16% | 55%
smithy-codegen-core0% | 0% | 10% | 17% | 72%
smithy-linters0% | 0% | 22% | 22% | 54%
smithy-mqtt-traits0% | 0% | 21% | 27% | 50%
smithy-aws-iam-traits0% | 0% | 25% | 9% | 64%
smithy-waiters0% | 0% | 10% | 26% | 63%
smithy-aws-apigateway-traits0% | 0% | 5% | 14% | 80%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
static OpenApiMapper compose()
in smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/OpenApiMapper.java
153 22 1
static OpenApiMapper wrap()
in smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/ApiGatewayMapper.java
133 16 1
public static int levenshteinDistance()
in smithy-utils/src/main/java/software/amazon/smithy/utils/StringUtils.java
123 24 3
TokenIterator doTokenize()
in smithy-jmespath/src/main/java/software/amazon/smithy/jmespath/Lexer.java
95 33 0
private void parseShape()
in smithy-model/src/main/java/software/amazon/smithy/model/loader/IdlModelParser.java
88 26 1
public static String wrap()
in smithy-utils/src/main/java/software/amazon/smithy/utils/StringUtils.java
87 22 5
private String consumeInsideString()
in smithy-jmespath/src/main/java/software/amazon/smithy/jmespath/Lexer.java
83 24 0
private static String parseStringContents()
in smithy-model/src/main/java/software/amazon/smithy/model/loader/IdlTextParser.java
80 25 3
static InternalSelector of()
in smithy-model/src/main/java/software/amazon/smithy/model/selector/AndSelector.java
76 9 1
public Builder disableProperty()
in smithy-jsonschema/src/main/java/software/amazon/smithy/jsonschema/Schema.java
75 35 1
private void loadShape()
in smithy-model/src/main/java/software/amazon/smithy/model/loader/AstModelLoader.java
73 23 4
private void addPaths()
in smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/OpenApiConverter.java
71 11 4
public Node toNode()
in smithy-jsonschema/src/main/java/software/amazon/smithy/jsonschema/Schema.java
69 13 0
private AttributeComparator parseComparator()
in smithy-model/src/main/java/software/amazon/smithy/model/selector/SelectorParser.java
65 15 1
private InternalSelector createSelector()
in smithy-model/src/main/java/software/amazon/smithy/model/selector/SelectorParser.java
62 16 0
private List validateMember()
in smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/PaginatedTraitValidator.java
61 15 6
private Optional validateTarget()
in smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/TargetValidator.java
61 24 4
private void visitLiteral()
in smithy-jmespath/src/main/java/software/amazon/smithy/jmespath/ExpressionSerializer.java
57 15 2
private List validateOperation()
in smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/HttpMethodSemanticsValidator.java
54 13 3
public void execute()
in smithy-cli/src/main/java/software/amazon/smithy/cli/commands/BuildCommand.java
54 10 2