bazelbuild / rules_rust
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 116 units with 3,101 lines of code in units (17.0% of code).
    • 5 very long units (613 lines of code)
    • 13 long units (928 lines of code)
    • 31 medium size units (1,030 lines of code)
    • 20 small units (280 lines of code)
    • 47 very small units (250 lines of code)
19% | 29% | 33% | 9% | 8%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs17% | 30% | 34% | 10% | 6%
cc28% | 25% | 27% | 3% | 14%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tools/rust_analyzer36% | 36% | 24% | 2% | 0%
util/process_wrapper28% | 25% | 27% | 3% | 14%
cargo/cargo_build_script_runner33% | 18% | 35% | 8% | 4%
crate_universe/src13% | 37% | 29% | 13% | 5%
util/label0% | 58% | 20% | 8% | 11%
tools/rustdoc0% | 0% | 77% | 9% | 13%
tools/rustfmt0% | 0% | 77% | 10% | 11%
util/dir_zipper0% | 0% | 100% | 0% | 0%
proto0% | 0% | 66% | 33% | 0%
tools/runfiles0% | 0% | 29% | 39% | 30%
cargo/bootstrap0% | 0% | 0% | 70% | 30%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
int PW_MAIN()
in util/process_wrapper/process_wrapper.cc
172 42 3
fn run_buildrs()
in cargo/cargo_build_script_runner/bin.rs
124 14 0
fn consolidate_lib_then_test_specs()
in tools/rust_analyzer/aquery.rs
107 1 0
fn consolidate_test_then_lib_specs()
in tools/rust_analyzer/aquery.rs
107 1 0
fn get_per_triple_metadata()
in crate_universe/src/renderer.rs
103 3 1
fn consolidate_lib_test_main_specs()
in tools/rust_analyzer/aquery.rs
95 2 0
fn new_tera()
in crate_universe/src/renderer.rs
92 1 0
int System::Exec()
in util/process_wrapper/system_windows.cc
85 15 5
fn test_package_name_parsing()
in util/label/label.rs
84 1 0
fn extra_deps_as_targeted_deps()
in crate_universe/src/consolidator.rs
72 5 5
fn render_helper_functions()
in crate_universe/src/renderer.rs
71 4 2
int System::Exec()
in util/process_wrapper/system_posix.cc
68 20 5
fn test_from_read_buffer_to_env_and_flags()
in cargo/cargo_build_script_runner/lib.rs
68 1 0
fn consume_package_name)>()
in util/label/label.rs
67 16 1
fn generate_rust_project_with_deps()
in tools/rust_analyzer/rust_project.rs
61 3 0
fn consolidate_proc_macro_prefer_exec()
in tools/rust_analyzer/aquery.rs
59 2 0
fn from()
in crate_universe/src/parser.rs
54 6 1
fn test_repository_name_parsing()
in util/label/label.rs
52 1 0
fn parse_args()
in tools/rustdoc/rustdoc_test_writer.rs
49 1 0
fn query_rustfmt_targets()
in tools/rustfmt/srcs/main.rs
45 3 1