awslabs / tough
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 244 units with 3,219 lines of code in units (36.2% of code).
    • 0 very long units (0 lines of code)
    • 11 long units (829 lines of code)
    • 30 medium size units (904 lines of code)
    • 35 small units (503 lines of code)
    • 168 very small units (983 lines of code)
0% | 25% | 28% | 15% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs0% | 25% | 28% | 15% | 30%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tough/src0% | 26% | 20% | 16% | 35%
tuftool/src0% | 29% | 38% | 16% | 15%
tough-kms/src0% | 59% | 0% | 0% | 40%
olpc-cjson/src0% | 0% | 58% | 10% | 31%
tough-ssm/src0% | 0% | 100% | 0% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
fn load_targets()
in tough/src/lib.rs
97 7 7
fn load_root()
in tough/src/lib.rs
89 6 7
fn load_snapshot()
in tough/src/lib.rs
89 6 6
fn targets_iter_and_map_test()
in tough/src/schema/mod.rs
89 1 0
fn load_delegations()
in tough/src/lib.rs
81 6 7
fn sign()
in tuftool/src/root.rs
76 7 4
fn target_path()
in tough/src/editor/signed.rs
68 7 4
fn load()
in tough/src/lib.rs
67 2 1
fn update_metadata()
in tuftool/src/update.rs
61 7 2
fn with_repo_editor()
in tuftool/src/add_role.rs
60 3 3
fn as_sign()
in tough-kms/src/lib.rs
52 1 1
fn clean_name()
in tough/src/target_name.rs
50 5 1
fn load_timestamp()
in tough/src/lib.rs
48 4 6
fn fetch_with_retries()
in tough/src/http.rs
44 3 3
fn actual_tuf_signed()
in olpc-cjson/src/lib.rs
39 1 0
fn ascii_control_characters()
in olpc-cjson/src/lib.rs
38 1 0
fn from_str()
in tough/src/schema/key.rs
36 5 1
fn gen_rsa_key()
in tuftool/src/root.rs
35 1 5
fn update_targets()
in tuftool/src/update_targets.rs
34 5 2
fn create_key_holder()
in tough/src/editor/targets.rs
34 2 2