facebookresearch / ParlAI
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 5,252 units with 55,143 lines of code in units (61.7% of code).
    • 21 very long units (3,485 lines of code)
    • 108 long units (7,052 lines of code)
    • 498 medium size units (14,841 lines of code)
    • 976 small units (13,961 lines of code)
    • 3,649 very small units (15,804 lines of code)
6% | 12% | 26% | 25% | 28%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py6% | 12% | 26% | 25% | 28%
js0% | 30% | 26% | 34% | 8%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
parlai/tasks6% | 11% | 29% | 29% | 24%
parlai/crowdsourcing11% | 15% | 29% | 24% | 19%
parlai/agents7% | 8% | 22% | 23% | 38%
parlai/core5% | 15% | 22% | 25% | 31%
parlai/scripts11% | 22% | 34% | 17% | 13%
parlai/chat_service6% | 8% | 27% | 18% | 40%
projects/dialogue_unlikelihood28% | 14% | 22% | 5% | 28%
projects/light_whoami7% | 20% | 9% | 25% | 36%
parlai/utils0% | 12% | 29% | 21% | 37%
parlai/torchscript0% | 46% | 19% | 11% | 21%
projects/anti_scaling0% | 28% | 26% | 24% | 20%
parlai/nn0% | 33% | 0% | 6% | 59%
projects/wizard_of_wikipedia0% | 9% | 43% | 22% | 24%
projects/style_gen0% | 24% | 29% | 12% | 33%
projects/blenderbot20% | 0% | 47% | 24% | 27%
projects/image_chat0% | 0% | 44% | 36% | 19%
projects/personality_captions0% | 0% | 35% | 45% | 18%
projects/safety_bench0% | 0% | 32% | 0% | 67%
projects/tod_simulator0% | 0% | 36% | 9% | 53%
projects/msc0% | 0% | 28% | 10% | 60%
website0% | 0% | 34% | 26% | 38%
ROOT0% | 0% | 56% | 21% | 21%
parlai/zoo0% | 0% | 0% | 38% | 61%
projects/params_vs_compute0% | 0% | 0% | 73% | 26%
parlai/mutators0% | 0% | 0% | 35% | 64%
projects/md_gender0% | 0% | 0% | 0% | 100%
example_parlai_internal/agents0% | 0% | 0% | 0% | 100%
projects/genderation_bias0% | 0% | 0% | 0% | 100%
projects/safety_recipes0% | 0% | 0% | 0% | 100%
projects/dialogue_bias0% | 0% | 0% | 0% | 100%
parlai0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def compile_results()
in parlai/crowdsourcing/projects/multisession_chat/human_eval/compile_results.py
303 73 1
def compile_results()
in parlai/crowdsourcing/tasks/model_chat/analysis/compile_results.py
302 86 1
def setup_rag_args()
in parlai/agents/rag/args.py
268 3 1
def main()
in parlai/tasks/eli5/data_creation/download_support_docs.py
220 74 0
def main()
in parlai/tasks/eli5/data_creation/download_reddit_qalist.py
199 52 0
def add_mturk_args()
in parlai/core/params.py
187 2 1
def setup_args()
in parlai/scripts/train_model.py
183 2 1
def setup_data()
in parlai/tasks/msc/agents.py
174 46 2
def write_dialog()
in parlai/tasks/light_dialog/builder.py
156 60 5
def write_dialog()
in parlai/tasks/light_dialog_wild/builder.py
156 56 5
def eval_wordstat()
in parlai/scripts/eval_wordstat.py
149 23 1
def _build_candidates()
in parlai/core/torch_ranker_agent.py
142 36 4
def setup_heroku_server()
in parlai/chat_service/utils/server.py
138 19 1
def add_parlai_args()
in parlai/core/params.py
124 1 2
def get_context()
in parlai/tasks/blended_skill_talk/agents.py
123 6 1
def convert_model_weight()
in parlai/agents/bart/convert_fairseq_to_parlai.py
122 33 2
def add_common_cmdline_args()
in parlai/agents/transformer/transformer.py
119 1 1
def __init__()
in parlai/tasks/wizard_of_wikipedia/agents.py
113 8 3
def compute_loss()
in projects/dialogue_unlikelihood/agents.py
103 29 3
def __init__()
in parlai/scripts/train_model.py
103 28 2