tensorflow / docs
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 339 units with 2,987 lines of code in units (43.5% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (84 lines of code)
    • 26 medium size units (745 lines of code)
    • 69 small units (1,034 lines of code)
    • 243 very small units (1,124 lines of code)
0% | 2% | 24% | 34% | 37%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs0% | 100% | 0% | 0% | 0%
py0% | 0% | 25% | 35% | 38%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tools/tensorflow_docs/api_generator0% | 3% | 19% | 38% | 37%
tools/tensorflow_docs/tools0% | 0% | 41% | 24% | 34%
tools/tensorflow_docs/plots0% | 0% | 71% | 0% | 28%
tools/tensorflow_docs/vis0% | 0% | 35% | 0% | 64%
tools/templates0% | 0% | 0% | 77% | 22%
tools/tensorflow_docs/modeling0% | 0% | 0% | 0% | 100%
tools/release_tools0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
will not include the generics in the class name()
in tools/tensorflow_docs/api_generator/gen_java/templates/macros.cs
84 6 1
def get_defined_in()
in tools/tensorflow_docs/api_generator/parser.py
49 11 2
def _add_proto_fields()
in tools/tensorflow_docs/api_generator/traverse.py
46 16 3
def generate_global_index()
in tools/tensorflow_docs/api_generator/parser.py
38 16 3
def run()
in tools/tensorflow_docs/tools/nblint/linter.py
36 11 5
def add_styles()
in tools/tensorflow_docs/tools/nblint/__main__.py
35 8 3
def plot()
in tools/tensorflow_docs/plots/__init__.py
33 7 4
def build()
in tools/tensorflow_docs/api_generator/generate_lib.py
32 6 2
def _add_method()
in tools/tensorflow_docs/api_generator/pretty_docs/class_page.py
32 7 4
def _maybe_find_duplicates()
in tools/tensorflow_docs/api_generator/doc_generator_visitor.py
30 12 1
def _score_name()
in tools/tensorflow_docs/api_generator/doc_generator_visitor.py
28 11 2
def should_skip_class_attr()
in tools/tensorflow_docs/api_generator/doc_controls.py
28 9 2
def format_kwargs()
in tools/tensorflow_docs/api_generator/signature.py
27 8 4
def clean_cells()
in tools/tensorflow_docs/tools/nbfmt/__main__.py
27 16 4
def _run_lint_group()
in tools/tensorflow_docs/tools/nblint/linter.py
27 11 7
def main()
in tools/tensorflow_docs/tools/nblint/__main__.py
27 10 1
def lint_params()
in tools/tensorflow_docs/api_generator/report/linter.py
26 9 1
def _augment_attributes()
in tools/tensorflow_docs/api_generator/pretty_docs/class_page.py
26 10 2
def clean_root()
in tools/tensorflow_docs/tools/nbfmt/__main__.py
24 2 3
def __str__()
in tools/tensorflow_docs/tools/nblint/linter.py
23 14 1