dart-lang / linter
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,135 units with 10,856 lines of code in units (47.6% of code).
    • 2 very long units (318 lines of code)
    • 10 long units (599 lines of code)
    • 98 medium size units (2,898 lines of code)
    • 186 small units (2,632 lines of code)
    • 839 very small units (4,409 lines of code)
2% | 5% | 26% | 24% | 40%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
dart2% | 5% | 26% | 24% | 40%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib/src36% | 0% | 18% | 21% | 23%
lib/src/rules0% | 4% | 22% | 24% | 48%
tool0% | 12% | 46% | 17% | 22%
lib/src/util0% | 10% | 30% | 34% | 24%
tool/canonical0% | 0% | 72% | 8% | 18%
tool/bot0% | 0% | 54% | 45% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void registerLintRules()
in lib/src/rules.dart
207 1 1
Future runLinter()
in lib/src/cli.dart
111 17 2
void visitParenthesizedExpression()
in lib/src/rules/unnecessary_parenthesis.dart
75 39 1
void visitConstructorDeclaration()
in lib/src/rules/prefer_initializing_formals.dart
66 21 1
void _check()
in lib/src/rules/prefer_is_empty.dart
65 32 3
void generate()
in tool/doc.dart
64 10 1
bool isMountedCheck()
in lib/src/rules/use_build_context_synchronously.dart
60 22 2
LinkedHashSet _findContradictoryComparisons()
in lib/src/util/tested_expressions.dart
57 13 2
StringBuffer buildFooter()
in tool/scorecard.dart
55 16 2
static bool unrelatedTypes()
in lib/src/util/dart_type_utilities.dart
53 23 3
void visitInstanceCreationExpression()
in lib/src/rules/prefer_for_elements_to_map_fromIterable.dart
53 18 1
void visitSwitchStatement()
in lib/src/rules/exhaustive_cases.dart
51 14 1
static bool matchesArgumentsWithParameters()
in lib/src/util/dart_type_utilities.dart
49 14 2
StringBuffer buildFooter()
in tool/canonical/scorecard.dart
48 16 2
void _visitClassOrMixin()
in lib/src/rules/public_member_api_docs.dart
47 15 1
DartType? getExpectedType()
in lib/src/rules/unnecessary_null_checks.dart
44 17 1
void main()
in tool/pana_baseline.dart
44 5 0
void generate()
in tool/doc.dart
44 8 1
void visitCompilationUnit()
in lib/src/rules/lines_longer_than_80_chars.dart
43 11 1
void visitLexeme()
in lib/src/rules/unnecessary_string_escapes.dart
43 17 6