facebook / relay
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
txt
gitattributes
watchmanconfig
babelrc
eslintignore
  • 20 extensions are included in analyses: js, md, graphql, rs, json, toml, snap, txt, css, yml, svg, gitignore, htm, py, gitattributes, watchmanconfig, sh, yaml, babelrc, eslintignore
  • 4 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/docs/.*" (Documentation) (95 files).
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (13 files).
    • exclude files with path like ".*/react(-[^.]*)?\.js" (React) (142 files).
    • exclude files with path like ".*/flow-typed/.*\.js" (flow-typed) (3 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.

main83545 LOC (19%) 492 files
test99688 LOC (23%) 1357 files
generated94270 LOC (21%) 1021 files
build and deployment3 LOC (<1%) 1 files
other154459 LOC (35%) 1248 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 ".*".
  • 492 files match defined criteria (83,545 lines of code, 100.0% vs. main code):
    • 309 *.rs files (60,445 lines of code)
    • 142 *.js files (20,178 lines of code)
    • 5 *.css files (1,963 lines of code)
    • 32 *.toml files (694 lines of code)
    • 2 *.graphql files (199 lines of code)
    • 1 *.yaml files (48 lines of code)
    • 1 *.py files (18 lines of code)
  • " *.rs" is biggest, containing 72.35% of code.
  • " *.py" is smallest, containing 0.02% of code.


*.rs60445 LOC (72%) 309 files
*.js20178 LOC (24%) 142 files
*.css1963 LOC (2%) 5 files
*.toml694 LOC (<1%) 32 files
*.graphql199 LOC (<1%) 2 files
*.yaml48 LOC (<1%) 1 files
*.py18 LOC (<1%) 1 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
snap
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.][Tt]ests[.].*".
    • files with paths like ".*[.]tests[.].*".
    • files with paths like ".*/__mocks?__/.*".
    • files with paths like ".*__tests__.*".
    • files with paths like ".*_test[.].*".
    • files with paths like ".*[.]snap".
    • files with paths like ".*[-]test[-].*".
    • files with paths like ".*/[Tt]ests/.*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*_tests[.].*".
    • files with paths like ".*[-]tests/.*".
  • 1357 files match defined criteria (99,688 lines of code, 119.3% vs. main code):
    • 186 *.js files (67,042 lines of code)
    • 977 *.graphql files (18,661 lines of code)
    • 173 *.rs files (10,124 lines of code)
    • 18 *.snap files (3,814 lines of code)
    • 3 *.toml files (47 lines of code)
  • " *.js" is biggest, containing 67.25% of code.
  • " *.toml" is smallest, containing 0.05% of code.


*.js67042 LOC (67%) 186 files
*.graphql18661 LOC (18%) 977 files
*.rs10124 LOC (10%) 173 files
*.snap3814 LOC (3%) 18 files
*.toml47 LOC (<1%) 3 files
Generated Code
Automatically generated files, not manually changed after generation.
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*/__generated__/.*".
  • 1021 files match defined criteria (94,270 lines of code, 112.8% vs. main code). All matches are in *.js files.


*.js94270 LOC (100%) 1021 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 ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/package[.]json".
    • 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
txt
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]json".
    • files with paths like ".*[.]md".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]svg".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[.]eslintignore".
    • files with paths like ".*/[Ee]xamples/.*".
  • 1248 files match defined criteria (154,459 lines of code, 184.9% vs. main code):
    • 1,194 *.md files (148,862 lines of code)
    • 40 *.json files (5,355 lines of code)
    • 9 *.txt files (127 lines of code)
    • 2 *.rs files (65 lines of code)
    • 3 *.svg files (50 lines of code)
  • " *.md" is biggest, containing 96.38% of code.
  • " *.svg" is smallest, containing 0.03% of code.


*.md148862 LOC (96%) 1194 files
*.json5355 LOC (3%) 40 files
*.txt127 LOC (<1%) 9 files
*.rs65 LOC (<1%) 2 files
*.svg50 LOC (<1%) 3 files
Analyzers
Info about analyzers used for source code examinations.
  • *.rs files are analyzed with RustAnalyzer:
    • 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
  • *.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
  • *.graphql 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
  • *.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
  • *.py files are analyzed with PythonAnalyzer:
    • 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
    • Basic heuristic dependency analysis


2022-04-14 23:04