facebook / jest
Source Code Overview

Analysis scope, overview of main, test, generated, deployment, build, and other code.

Source Code Analysis Scope
Files includes and excluded from analyses
snap
npmignore
mjs
txt
watchmanconfig
gitattributes
patch
editorconfig
babelrc
hbs
eslintignore
prettierignore
  • 27 extensions are included in analyses: js, ts, json, md, snap, npmignore, mjs, yml, cjs, css, svg, jsx, txt, gitignore, tsx, watchmanconfig, gitattributes, patch, sh, xml, editorconfig, yaml, babelrc, toml, hbs, eslintignore, prettierignore
  • 8 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (104 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (35 files).
    • exclude files with path like ".*/react(-[^.]*)?\.js" (React) (4 files).
    • exclude files with path like "(?i).*/jquery.*[.]js" (jQuery files) (4 files).
    • exclude files with path like ".*/angular([^.]*)\.js" (AngularJS) (1 file).
    • exclude files with path like ".*/bin/.*" (Binaries for distribution) (4 files).
    • exclude files with path like ".*\.d\.ts" (Typescript definition files) (2 files).
    • exclude files with path like ".*/cache/.*" (Caches) (7 files).
Overview of Analyzed Files
Basic stats on analyzed files
Intro
For analysis purposes we separate files in scope into several categories: main, test, generated, deployment and build, and other.

  • The main category contains all manually created source code files that are being used in the production.
  • Files in the main category are used as input for other analyses: logical decomposition, concerns, duplication, file size, unit size, and conditional complexity.
  • Test source code files are used only for testing of the product. These files are normally not deployed to production.
  • Build and deployment source code files are used to configure or support build and deployment process.
  • Generated source code files are automatically generated files that have not been manually changed after generation.
  • While a source code folder may contain a number of files, we are primarily interested in the source code files that are being written and maintained by developers.
  • Files containing binaries, documentation, or third-party libraries, for instance, are excluded from analysis. The exception are third-party libraries that have been changed by developers.

main42592 LOC (24%) 381 files
test72498 LOC (40%) 1272 files
generated0 LOC (0%) 0 files
build and deployment3 LOC (<1%) 1 files
other61801 LOC (34%) 762 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 381 files match defined criteria (42,592 lines of code, 100.0% vs. main code):
    • 328 *.ts files (38,045 lines of code)
    • 44 *.js files (3,620 lines of code)
    • 6 *.css files (859 lines of code)
    • 1 *.yaml files (38 lines of code)
    • 1 *.toml files (21 lines of code)
    • 1 *.xml files (9 lines of code)
  • " *.ts" is biggest, containing 89.32% of code.
  • " *.xml" is smallest, containing 0.02% of code.


*.ts38045 LOC (89%) 328 files
*.js3620 LOC (8%) 44 files
*.css859 LOC (2%) 6 files
*.yaml38 LOC (<1%) 1 files
*.toml21 LOC (<1%) 1 files
*.xml9 LOC (<1%) 1 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
snap
mjs
hbs
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[-]test[-].*".
    • files with paths like ".*[.][Tt]est[.].*".
    • files with paths like ".*[.]test[.].*".
    • files with paths like ".*__tests__.*".
    • files with paths like ".*[.]snap".
    • files with paths like ".*/__mocks?__/.*".
    • files with paths like ".*[.]spec[.]ts".
    • files with paths like ".*_test[.].*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*/e2e/.*".
    • files with paths like ".*[-]tests[-].*".
    • files with paths like ".*[-]tests/.*".
  • 1272 files match defined criteria (72,498 lines of code, 170.2% vs. main code):
    • 369 *.ts files (37,347 lines of code)
    • 729 *.js files (18,221 lines of code)
    • 128 *.snap files (15,792 lines of code)
    • 1 *.tsx files (719 lines of code)
    • 20 *.mjs files (278 lines of code)
    • 12 *.cjs files (69 lines of code)
    • 7 *.jsx files (39 lines of code)
    • 5 *.css files (20 lines of code)
    • 1 *.hbs files (13 lines of code)
  • " *.ts" is biggest, containing 51.51% of code.
  • " *.hbs" is smallest, containing 0.02% of code.


*.ts37347 LOC (51%) 369 files
*.js18221 LOC (25%) 729 files
*.snap15792 LOC (21%) 128 files
*.tsx719 LOC (<1%) 1 files
*.mjs278 LOC (<1%) 20 files
*.cjs69 LOC (<1%) 12 files
*.jsx39 LOC (<1%) 7 files
*.css20 LOC (<1%) 5 files
*.hbs13 LOC (<1%) 1 files
Build and Deployment Code
Source code used to configure or support build and deployment process.
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*/package[.]json".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]sh".
    • files with paths like ".*/[.]gitattributes".
  • 1 file matches defined criteria (3 lines of code, 0.0% vs. main code). All matches are in *.sh files.


*.sh3 LOC (100%) 1 files
Other Code
snap
patch
txt
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]md".
    • files with paths like ".*[.]json".
    • files with paths like ".*[.]patch".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]svg".
    • files with paths like ".*/[.]prettierignore".
    • files with paths like ".*[.]editorconfig".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/[Ee]xamples/.*".
    • files with paths like ".*/[.]npmignore".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[.]eslintignore".
  • 762 files match defined criteria (61,801 lines of code, 145.1% vs. main code):
    • 292 *.md files (54,066 lines of code)
    • 397 *.json files (6,558 lines of code)
    • 46 *.js files (606 lines of code)
    • 16 *.ts files (301 lines of code)
    • 3 *.snap files (169 lines of code)
    • 2 *.tsx files (48 lines of code)
    • 1 *.svg files (34 lines of code)
    • 1 *.patch files (13 lines of code)
    • 4 *.txt files (6 lines of code)
  • " *.md" is biggest, containing 87.48% of code.
  • " *.txt" is smallest, containing 0.01% of code.


*.md54066 LOC (87%) 292 files
*.json6558 LOC (10%) 397 files
*.js606 LOC (<1%) 46 files
*.ts301 LOC (<1%) 16 files
*.snap169 LOC (<1%) 3 files
*.tsx48 LOC (<1%) 2 files
*.svg34 LOC (<1%) 1 files
*.patch13 LOC (<1%) 1 files
*.txt6 LOC (<1%) 4 files
Analyzers
Info about analyzers used for source code examinations.
  • *.ts files are analyzed with TypeScriptAnalyzer:
    • All basic standard analyses supported (source code overview, duplication, file size, concerns, findings, metrics, controls)
    • Advanced code cleaning (empty lines and comments removed for LOC calculations, additional cleaning for duplication calculations)
    • Unit size analysis
    • Conditional complexity analysis
    • No dependency analysis
  • *.js files are analyzed with JavaScriptAnalyzer:
    • All basic standard analyses supported (source code overview, duplication, file size, concerns, findings, metrics, controls)
    • Advanced code cleaning (empty lines and comments removed for LOC calculations, additional cleaning for duplication calculations)
    • Unit size analysis
    • Conditional complexity analysis
    • No dependency analysis
  • *.css files are analyzed with CssAnalyzer:
    • All basic standard analyses supported (source code overview, duplication, file size, concerns, findings, metrics, controls)
    • Advanced code cleaning (empty lines and comments removed for LOC calculations, additional cleaning for duplication calculations)
    • No unit size analysis
    • No conditional complexity analysis
    • No dependency analysis
  • *.yaml files are analyzed with YamlAnalyzer:
    • All basic standard analyses supported (source code overview, duplication, file size, concerns, findings, metrics, controls)
    • Advanced code cleaning (empty lines and comments removed for LOC calculations, additional cleaning for duplication calculations)
    • No unit size analysis
    • No conditional complexity analysis
    • No dependency analysis
  • *.toml files are analyzed with DefaultLanguageAnalyzer:
    • All basic standard analyses supported (source code overview, duplication, file size, concerns, findings, metrics, controls)
    • Basic code cleaning (empty lines removed for LOC calculations and duplication calculations)
    • No unit size analysis
    • No conditional complexity analysis
    • No dependency analysis
  • *.xml files are analyzed with XmlAnalyzer:
    • All basic standard analyses supported (source code overview, duplication, file size, concerns, findings, metrics, controls)
    • Advanced code cleaning (empty lines and comments removed for LOC calculations, additional cleaning for duplication calculations)
    • No unit size analysis
    • No conditional complexity analysis
    • No dependency analysis


2022-04-14 22:52