facebookresearch / hydra
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 678 units with 5,202 lines of code in units (43.4% of code).
    • 1 very long units (109 lines of code)
    • 8 long units (505 lines of code)
    • 46 medium size units (1,368 lines of code)
    • 68 small units (969 lines of code)
    • 555 very small units (2,251 lines of code)
2% | 9% | 26% | 18% | 43%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py2% | 8% | 26% | 18% | 43%
js0% | 96% | 0% | 0% | 4%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
plugins/hydra_optuna_sweeper56% | 0% | 20% | 0% | 22%
hydra/_internal0% | 6% | 26% | 21% | 45%
plugins/hydra_nevergrad_sweeper0% | 55% | 17% | 9% | 17%
website/src0% | 100% | 0% | 0% | 0%
tools/configen0% | 28% | 40% | 19% | 12%
hydra/core0% | 4% | 18% | 23% | 52%
plugins/hydra_ray_launcher0% | 23% | 12% | 5% | 57%
hydra/plugins0% | 18% | 34% | 19% | 27%
ROOT0% | 0% | 67% | 9% | 22%
plugins/hydra_ax_sweeper0% | 0% | 39% | 18% | 42%
build_helpers0% | 0% | 43% | 11% | 44%
tools/release0% | 0% | 28% | 49% | 22%
tools/ci0% | 0% | 63% | 29% | 6%
hydra0% | 0% | 0% | 19% | 80%
hydra/extra0% | 0% | 0% | 52% | 47%
hydra/experimental0% | 0% | 0% | 0% | 100%
plugins/hydra_joblib_launcher0% | 0% | 0% | 0% | 100%
plugins/hydra_submitit_launcher0% | 0% | 0% | 0% | 100%
plugins/hydra_rq_launcher0% | 0% | 0% | 0% | 100%
plugins/hydra_colorlog0% | 0% | 0% | 0% | 100%
website0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def sweep()
in plugins/hydra_optuna_sweeper/hydra_plugins/hydra_optuna_sweeper/_impl.py
109 24 2
def sweep()
in plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/_impl.py
73 19 2
function Home()
in website/src/pages/index.js
72 4 0
def run_and_report()
in hydra/_internal/utils.py
71 16 1
def generate_module()
in tools/configen/configen/configen.py
69 18 2
def set_up_machine()
in plugins/hydra_ray_launcher/integration_test_tools/create_integration_test_ami.py
56 11 1
def visitOverride()
in hydra/core/override_parser/overrides_visitor.py
56 14 2
def _apply_overrides_to_config()
in hydra/_internal/config_loader_impl.py
54 14 2
def _get_matches()
in hydra/plugins/completion_plugin.py
54 20 2
def sweep()
in plugins/hydra_ax_sweeper/hydra_plugins/hydra_ax_sweeper/_core.py
48 10 2
def get_args_parser()
in hydra/_internal/utils.py
48 1 0
47 10 2
def _query_config_groups()
in hydra/plugins/completion_plugin.py
46 19 2
def __init__()
in hydra/_internal/defaults_list.py
45 12 3
def lint()
in noxfile.py
43 5 1
def _locate()
in hydra/_internal/utils.py
41 15 1
def create_optuna_distribution_from_override()
in plugins/hydra_optuna_sweeper/hydra_plugins/hydra_optuna_sweeper/_impl.py
40 13 1
def type_str()
in tools/configen/configen/utils.py
37 14 1
37 7 2
def coverage()
in noxfile.py
37 4 1