microsoft / python-language-server
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 15,512 units with 46,994 lines of code in units (61.9% of code).
    • 10 very long units (1,660 lines of code)
    • 56 long units (3,574 lines of code)
    • 308 medium size units (9,531 lines of code)
    • 596 small units (8,601 lines of code)
    • 14,542 very small units (23,628 lines of code)
3% | 7% | 20% | 18% | 50%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs4% | 11% | 30% | 26% | 27%
py28% | 9% | 27% | 21% | 13%
pyi0% | 0% | <1% | 2% | 96%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/Analysis/Ast/Impl2% | 2% | 12% | 13% | 69%
src/Parsing/Impl/Tokens25% | 22% | 21% | 17% | 13%
src/Parsing/Impl4% | 25% | 40% | 16% | 12%
src/LanguageServer/Impl/Formatting60% | 0% | 21% | 11% | 6%
src/Parsing/Impl/Ast0% | 7% | 16% | 28% | 47%
src/LanguageServer/Impl/Completion0% | 33% | 40% | 16% | 10%
src/LanguageServer/Impl/Sources0% | 23% | 45% | 19% | 11%
src/Caching/Impl/Models0% | 37% | 24% | 14% | 23%
src/LanguageServer/Impl0% | 11% | 35% | 21% | 32%
src0% | 53% | 36% | 0% | 10%
src/LanguageServer/Impl/Implementation0% | 8% | 34% | 34% | 23%
src/Core/Impl/Extensions0% | 8% | 27% | 29% | 34%
src/Analysis/Core/Impl0% | 0% | 33% | 43% | 23%
src/Core/Impl/IO0% | 0% | 56% | 23% | 19%
src/Caching/Impl0% | 0% | 50% | 36% | 12%
src/LanguageServer/Impl/CodeActions0% | 0% | 55% | 21% | 22%
src/LanguageServer/Impl/Indexing0% | 0% | 13% | 38% | 47%
src/Caching/Impl/Lazy0% | 0% | 33% | 25% | 41%
src/LanguageServer/Impl/Telemetry0% | 0% | 45% | 11% | 42%
src/Core/Impl/Threading0% | 0% | 9% | 56% | 33%
src/LanguageServer/Impl/Diagnostics0% | 0% | 18% | 46% | 35%
src/Core/Impl/Text0% | 0% | 13% | 30% | 55%
src/Core/Impl/Idle0% | 0% | 17% | 23% | 59%
src/Core/Impl/Collections0% | 0% | 10% | 51% | 38%
src/Caching/Impl/IO0% | 0% | 45% | 29% | 25%
src/LanguageServer/Impl/Services0% | 0% | 0% | 36% | 63%
src/LanguageServer/Impl/Utilities0% | 0% | 0% | 36% | 63%
src/Core/Impl/Disposables0% | 0% | 0% | 16% | 83%
src/Core/Impl/OS0% | 0% | 0% | 43% | 56%
src/LanguageServer/Impl/Protocol0% | 0% | 0% | 53% | 46%
src/LanguageServer/Impl/SearchPaths0% | 0% | 0% | 100% | 0%
src/LanguageServer/Impl/Optimization0% | 0% | 0% | 81% | 18%
src/Core/Impl/Services0% | 0% | 0% | 19% | 80%
src/Caching/Impl/Extensions0% | 0% | 0% | 68% | 31%
src/Core/Impl/Diagnostics0% | 0% | 0% | 0% | 100%
src/LanguageServer/Impl/Documents0% | 0% | 0% | 0% | 100%
src/LanguageServer/Impl/Definitions0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def add_builtin_objects()
in src/Analysis/Ast/Impl/scrape_module.py
374 3 1
private Token ReadName()
in src/Parsing/Impl/Tokens/Tokenizer.cs
229 195 0
private Token Next()
in src/Parsing/Impl/Tokens/Tokenizer.cs
156 56 0
private Expression FinishDictOrSetValue()
in src/Parsing/Impl/Parser.cs
150 46 0
private Token NextOperator()
in src/Parsing/Impl/Tokens/Tokenizer.cs
144 57 1
public delegate IMember ReturnValueProvider()
in src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs
136 31 4
public ArgumentSet()
in src/Analysis/Ast/Impl/Types/ArgumentSet.cs
134 40 5
private static void AppendTokenEnsureWhiteSpacesAround()
in src/LanguageServer/Impl/Formatting/LineFormatter.cs
122 41 2
public static string ParseString()
in src/Parsing/Impl/LiteralParser.cs
111 57 7
private IMember GetValueFromBinaryOp()
in src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Operators.cs
104 52 2
private static Dictionary MakeCodecsDict()
in src/Parsing/Impl/Parser.cs
100 56 0
private bool ReadIndentationAfterNewLine()
in src/Parsing/Impl/Tokens/Tokenizer.cs
96 22 1
private bool TryGetValueFromBuiltinBinaryOp()
in src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Operators.cs
93 47 5
private FunctionDefinition ParseFuncDef()
in src/Parsing/Impl/Parser.cs
93 21 1
public TokenInfo ReadToken()
in src/Parsing/Impl/Tokens/Tokenizer.cs
88 31 0
private Expression AddTrailers()
in src/Parsing/Impl/Parser.cs
82 17 2
private Expression ParsePrimary()
in src/Parsing/Impl/Parser.cs
81 25 0
public PythonVariable GetVariable()
in src/Parsing/Impl/Ast/Parameter.cs
78 17 1
public Hover GetHover()
in src/LanguageServer/Impl/Sources/HoverSource.cs
77 19 2
public static ModuleModel FromAnalysis()
in src/Caching/Impl/Models/ModuleModel.cs
75 20 3