GerritCodeReview / gerrit
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 27,000 units with 283,188 lines of code in units (63.4% of code).
    • 59 very long units (8,664 lines of code)
    • 383 long units (25,113 lines of code)
    • 2,731 medium size units (81,216 lines of code)
    • 5,208 small units (75,453 lines of code)
    • 18,619 very small units (92,742 lines of code)
3% | 8% | 28% | 26% | 32%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
java2% | 8% | 29% | 26% | 32%
ts5% | 10% | 26% | 25% | 31%
py13% | 10% | 18% | 29% | 27%
go0% | 28% | 42% | 15% | 14%
pl0% | 0% | 71% | 7% | 20%
js0% | 0% | 0% | 36% | 63%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
java3% | 10% | 27% | 22% | 36%
polygerrit-ui5% | 10% | 26% | 26% | 31%
javatests1% | 6% | 31% | 33% | 27%
tools5% | 12% | 25% | 25% | 30%
contrib0% | 21% | 37% | 16% | 24%
lib0% | 0% | 45% | 23% | 30%
resources0% | 0% | 0% | 0% | 100%
plugins0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
protected final void service()
in java/com/google/gerrit/httpd/restapi/RestApiServlet.java
423 71 2
protected void configure()
in java/com/google/gerrit/server/config/GerritGlobalModule.java
235 1 0
override render()
in polygerrit-ui/app/embed/diff/gr-diff-image-viewer/gr-image-viewer.ts
220 17 0
_startRouter()
in polygerrit-ui/app/elements/core/gr-router/gr-router.ts
219 7 0
function getStyleEl()
in polygerrit-ui/app/styles/themes/dark-theme.ts
208 2 0
private ImmutableList selectNewAndReplacedChangesFromMagicBranch()
in java/com/google/gerrit/server/git/receive/ReceiveCommits.java
203 43 1
public void fixAttentionFooter()
in javatests/com/google/gerrit/server/notedb/CommitRewriterTest.java
195 1 0
private boolean canCopyBasedOnBooleanLabelConfigs()
in java/com/google/gerrit/server/approval/ApprovalInference.java
189 21 8
private void parseMagicBranch()
in java/com/google/gerrit/server/git/receive/ReceiveCommits.java
184 47 1
void doAuth()
in java/com/google/gerrit/httpd/auth/openid/OpenIdServiceImpl.java
181 51 2
static override get styles()
in polygerrit-ui/app/elements/checks/gr-checks-results.ts
180 1 0
private Optional fixedCommitMessage()
in java/com/google/gerrit/server/notedb/CommitRewriter.java
177 43 2
static override get styles()
in polygerrit-ui/app/elements/checks/gr-checks-results.ts
171 2 0
public void publishCommentsAllRevisions()
in javatests/com/google/gerrit/acceptance/server/change/CommentsIT.java
171 1 0
List deleteDraftComments()
in java/com/google/gerrit/extensions/api/accounts/AccountApi.java
167 1 1
static override get styles()
in polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
166 1 0
protected void configure()
in java/com/google/gerrit/metrics/proc/JGitMetricModule.java
162 2 1
static override get styles()
in polygerrit-ui/app/elements/core/gr-main-header/gr-main-header.ts
160 1 0
public BatchMetaDataUpdate openUpdate()
in java/com/google/gerrit/server/git/meta/VersionedMetaData.java
158 35 4
protected void configure()
in java/com/google/gerrit/server/restapi/change/ChangeRestApiModule.java
157 1 0