aws-amplify / community
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 53 units with 774 lines of code in units (11.5% of code).
    • 1 very long units (164 lines of code)
    • 3 long units (187 lines of code)
    • 5 medium size units (165 lines of code)
    • 8 small units (124 lines of code)
    • 36 very small units (134 lines of code)
21% | 24% | 21% | 16% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js21% | 24% | 21% | 16% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
scripts/contribute100% | 0% | 0% | 0% | 0%
src/components0% | 50% | 27% | 10% | 10%
src/templates0% | 21% | 26% | 26% | 25%
scripts0% | 0% | 76% | 0% | 23%
gatsby-node0% | 0% | 0% | 87% | 12%
src/utilities0% | 0% | 0% | 0% | 100%
src0% | 0% | 0% | 0% | 100%
src/pages0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
prompt: async()
in scripts/contribute/extensions/contribution-extension.js
164 15 0
export default()
in src/components/Subscribe.js
80 9 1
export default()
in src/components/DateRange.js
55 3 4
query()
in src/templates/Landing.js
52 1 1
export default asCard()
in src/components/Card/Post/Expanded.js
47 5 9
query()
in src/templates/Contributor.js
36 1 1
featured: markdownRemark()
in src/templates/Posts.js
29 1 1
export default()
in src/components/FeaturedPosts.js
27 2 1
pathToFile: join()
in scripts/validations.js
26 9 2
query()
in src/templates/Events.js
18 1 1
markdownRemark()
in src/templates/Post.js
18 1 1
markdownRemark()
in src/templates/Event.js
18 1 1
export default()
in src/components/Card/Post/fragments/Author.js
15 2 4
posts: allMarkdownRemark()
in gatsby-node/createPages.js
15 1 1
export default()
in src/components/Checkbox.js
14 1 3
events: allMarkdownRemark()
in gatsby-node/createPages.js
14 1 1
allMarkdownRemark()
in src/templates/Contributors.js
12 1 1
context: sitePage()
in src/templates/Newsletter.js
10 1 1
export default()
in src/components/Button/ToggleMenu.js
10 1 0
export default()
in src/components/Hero.js
9 1 8