facebook / fbt
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
gitattributes
podspec
babelrc
txt
  • 21 extensions are included in analyses: js, md, json, snap, npmignore, css, gitignore, java, ts, gitattributes, sh, xml, yml, podspec, html, mm, svg, babelrc, h, gradle, txt
  • 8 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/flow-typed/.*\.js" (flow-typed) (3 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (15 files).
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (27 files).
    • exclude files with path like ".*/react(-[^.]*)?\.js" (React) (1 file).
    • exclude files with path like ".*\.d\.ts" (Typescript definition files) (1 file).
    • exclude files with path like ".*/bin/.*" (Binaries for distribution) (24 files).
    • exclude files with path like ".*/git[-]history[.]txt" (Git history) (1 file).
    • exclude files with path like ".*/git[-][a-zA-Z0-9_]+[.]txt" (Git data exports for sokrates analyses) (0 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.

main14910 LOC (16%) 226 files
test61418 LOC (69%) 102 files
generated0 LOC (0%) 0 files
build and deployment362 LOC (<1%) 6 files
other12010 LOC (13%) 42 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 ".*".
  • 226 files match defined criteria (14,910 lines of code, 100.0% vs. main code):
    • 215 *.js files (14,304 lines of code)
    • 6 *.css files (451 lines of code)
    • 2 *.java files (113 lines of code)
    • 1 *.mm files (25 lines of code)
    • 1 *.html files (11 lines of code)
    • 1 *.h files (6 lines of code)
  • " *.js" is biggest, containing 95.94% of code.
  • " *.h" is smallest, containing 0.04% of code.


*.js14304 LOC (95%) 215 files
*.css451 LOC (3%) 6 files
*.java113 LOC (<1%) 2 files
*.mm25 LOC (<1%) 1 files
*.html11 LOC (<1%) 1 files
*.h6 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 ".*/__mocks?__/.*".
    • files with paths like ".*__tests__.*".
    • files with paths like ".*[.]snap".
  • 102 files match defined criteria (61,418 lines of code, 411.9% vs. main code):
    • 93 *.js files (56,422 lines of code)
    • 8 *.snap files (4,993 lines of code)
    • 1 *.ts files (3 lines of code)
  • " *.js" is biggest, containing 91.87% of code.
  • " *.ts" is smallest, containing 0% of code.


*.js56422 LOC (91%) 93 files
*.snap4993 LOC (8%) 8 files
*.ts3 LOC (<1%) 1 files
Build and Deployment Code
Source code used to configure or support build and deployment process.
podspec
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*/package[.]json".
    • files with paths like ".*[.]sh".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]gradle".
    • files with paths like ".*/AndroidManifest[.]xml".
    • files with paths like ".*/[.]gitattributes".
    • files with paths like ".*[.]podspec".
    • files with paths like ".*([.]|/)webpack([.]|/).*".
  • 6 files match defined criteria (362 lines of code, 2.4% vs. main code):
    • 2 *.js files (216 lines of code)
    • 1 *.gradle files (101 lines of code)
    • 1 *.podspec files (28 lines of code)
    • 1 *.sh files (14 lines of code)
    • 1 *.xml files (3 lines of code)
  • " *.js" is biggest, containing 59.67% of code.
  • " *.xml" is smallest, containing 0.83% of code.


*.js216 LOC (59%) 2 files
*.gradle101 LOC (27%) 1 files
*.podspec28 LOC (7%) 1 files
*.sh14 LOC (3%) 1 files
*.xml3 LOC (<1%) 1 files
Other Code
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 ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]svg".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/[.]npmignore".
    • files with paths like ".*[.]txt".
  • 42 files match defined criteria (12,010 lines of code, 80.5% vs. main code):
    • 22 *.json files (11,044 lines of code)
    • 19 *.md files (965 lines of code)
    • 1 *.svg files (1 lines of code)
  • " *.json" is biggest, containing 91.96% of code.
  • " *.svg" is smallest, containing 0.01% of code.


*.json11044 LOC (91%) 22 files
*.md965 LOC (8%) 19 files
*.svg1 LOC (<1%) 1 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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
  • *.java files are analyzed with JavaAnalyzer:
    • 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
    • Advanced heuristic dependency analysis (based on package names)
  • *.mm files are analyzed with CppAnalyzer:
    • 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
    • Advanced heuristic dependency analysis
  • *.html files are analyzed with HtmlAnalyzer:
    • 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
    • Advanced heuristic dependency analysis
  • *.h files are analyzed with CppAnalyzer:
    • 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
    • Advanced heuristic dependency analysis


2022-04-14 23:23