facebook / react-native
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
mk
txt
podspec
clang-tidy
s
properties
plist
pro
npmignore
babelrc
clang-format
storyboard
command
editorconfig
eslintignore
gv
  • 36 extensions are included in analyses: js, h, java, cpp, m, mm, xml, snap, mk, txt, sh, kt, podspec, json, clang-tidy, md, bzl, s, yml, properties, plist, pro, gradle, npmignore, bat, kts, rb, babelrc, gitignore, html, clang-format, storyboard, command, editorconfig, eslintignore, gv
  • 7 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (61 files).
    • exclude files with path like ".*/(3rd|[Tt]hird)[-_]?[Pp]arty/.*" (Dependencies) (18 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (3 files).
    • exclude files with path like ".*/proguard[-]rules[.]pro" (ProGuard) (3 files).
    • exclude files with path like ".*/gradle/wrapper/.*" (Gradle) (3 files).
    • exclude files with path like ".*/react(-[^.]*)?\.js" (React) (155 files).
    • exclude files with path like ".*/flow-typed/.*\.js" (flow-typed) (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.

main266299 LOC (66%) 2949 files
test101175 LOC (25%) 484 files
generated0 LOC (0%) 0 files
build and deployment6565 LOC (1%) 156 files
other27207 LOC (6%) 261 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
pro
command
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 2949 files match defined criteria (266,299 lines of code, 100.0% vs. main code):
    • 590 *.js files (80,609 lines of code)
    • 724 *.java files (62,485 lines of code)
    • 282 *.cpp files (34,811 lines of code)
    • 828 *.h files (32,261 lines of code)
    • 158 *.mm files (25,932 lines of code)
    • 207 *.m files (25,472 lines of code)
    • 25 *.kt files (1,843 lines of code)
    • 17 *.bzl files (1,216 lines of code)
    • 105 *.xml files (794 lines of code)
    • 2 *.rb files (629 lines of code)
    • 4 *.kts files (110 lines of code)
    • 4 *.pro files (68 lines of code)
    • 2 *.html files (52 lines of code)
    • 1 *.command files (17 lines of code)
  • " *.js" is biggest, containing 30.27% of code.
  • " *.command" is smallest, containing 0.01% of code.


*.js80609 LOC (30%) 590 files
*.java62485 LOC (23%) 724 files
*.cpp34811 LOC (13%) 282 files
*.h32261 LOC (12%) 828 files
*.mm25932 LOC (9%) 158 files
*.m25472 LOC (9%) 207 files
*.kt1843 LOC (<1%) 25 files
*.bzl1216 LOC (<1%) 17 files
*.xml794 LOC (<1%) 105 files
*.rb629 LOC (<1%) 2 files
*.kts110 LOC (<1%) 4 files
*.pro68 LOC (<1%) 4 files
*.html52 LOC (<1%) 2 files
*.command17 LOC (<1%) 1 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
snap
command
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*_test[.].*".
    • files with paths like ".*/[Tt]ests/.*".
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*__tests__.*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*/__mocks?__/.*".
    • files with paths like ".*[.]snap".
    • files with paths like ".*/[Ss]pecs/.*".
    • files with paths like ".*/IntegrationTests?/.*".
    • files with paths like ".*[-]tests[-].*".
    • files with paths like ".*[-]test[-].*".
    • files with paths like ".*[.][Tt]est[.].*".
    • files with paths like ".*[.]test[.].*".
    • files with paths like ".*/e2e/.*".
    • files with paths like ".*/src/androidTest/.*".
  • 484 files match defined criteria (101,175 lines of code, 38.0% vs. main code):
    • 82 *.snap files (54,028 lines of code)
    • 198 *.js files (20,073 lines of code)
    • 105 *.java files (13,703 lines of code)
    • 57 *.cpp files (10,833 lines of code)
    • 18 *.kt files (1,073 lines of code)
    • 12 *.h files (717 lines of code)
    • 2 *.mm files (452 lines of code)
    • 4 *.sh files (164 lines of code)
    • 2 *.rb files (79 lines of code)
    • 2 *.xml files (39 lines of code)
    • 1 *.command files (8 lines of code)
    • 1 *.bzl files (6 lines of code)
  • " *.snap" is biggest, containing 53.4% of code.
  • " *.bzl" is smallest, containing 0.01% of code.


*.snap54028 LOC (53%) 82 files
*.js20073 LOC (19%) 198 files
*.java13703 LOC (13%) 105 files
*.cpp10833 LOC (10%) 57 files
*.kt1073 LOC (1%) 18 files
*.h717 LOC (<1%) 12 files
*.mm452 LOC (<1%) 2 files
*.sh164 LOC (<1%) 4 files
*.rb79 LOC (<1%) 2 files
*.xml39 LOC (<1%) 2 files
*.command8 LOC (<1%) 1 files
*.bzl6 LOC (<1%) 1 files
Build and Deployment Code
Source code used to configure or support build and deployment process.
mk
podspec
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]podspec".
    • files with paths like ".*/package[.]json".
    • files with paths like ".*[.]sh".
    • files with paths like ".*[.]mk".
    • 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 ".*[.]bat".
  • 156 files match defined criteria (6,565 lines of code, 2.5% vs. main code):
    • 63 *.mk files (2,138 lines of code)
    • 40 *.podspec files (1,681 lines of code)
    • 7 *.gradle files (1,233 lines of code)
    • 36 *.sh files (1,176 lines of code)
    • 4 *.bat files (215 lines of code)
    • 6 *.xml files (122 lines of code)
  • " *.mk" is biggest, containing 32.57% of code.
  • " *.xml" is smallest, containing 1.86% of code.


*.mk2138 LOC (32%) 63 files
*.podspec1681 LOC (25%) 40 files
*.gradle1233 LOC (18%) 7 files
*.sh1176 LOC (17%) 36 files
*.bat215 LOC (3%) 4 files
*.xml122 LOC (1%) 6 files
Other Code
txt
plist
storyboard
properties
mk
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]md".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]json".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/[Ss]amples/.*".
    • files with paths like ".*[.]storyboard".
    • files with paths like ".*[.]plist".
    • files with paths like ".*[.]properties".
    • files with paths like ".*/[.]npmignore".
    • files with paths like ".*[.]editorconfig".
    • files with paths like ".*/[Ee]xamples/.*".
    • files with paths like ".*/[.]eslintignore".
  • 261 files match defined criteria (27,207 lines of code, 10.2% vs. main code):
    • 119 *.js files (22,525 lines of code)
    • 63 *.txt files (1,528 lines of code)
    • 30 *.json files (976 lines of code)
    • 15 *.md files (561 lines of code)
    • 4 *.cpp files (505 lines of code)
    • 3 *.mm files (270 lines of code)
    • 8 *.plist files (266 lines of code)
    • 2 *.java files (234 lines of code)
    • 7 *.h files (138 lines of code)
    • 2 *.storyboard files (103 lines of code)
    • 7 *.properties files (83 lines of code)
    • 1 *.mk files (18 lines of code)
  • " *.js" is biggest, containing 82.79% of code.
  • " *.mk" is smallest, containing 0.07% of code.


*.js22525 LOC (82%) 119 files
*.txt1528 LOC (5%) 63 files
*.json976 LOC (3%) 30 files
*.md561 LOC (2%) 15 files
*.cpp505 LOC (1%) 4 files
*.mm270 LOC (<1%) 3 files
*.plist266 LOC (<1%) 8 files
*.java234 LOC (<1%) 2 files
*.h138 LOC (<1%) 7 files
*.storyboard103 LOC (<1%) 2 files
*.properties83 LOC (<1%) 7 files
*.mk18 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
  • *.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)
  • *.cpp 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
  • *.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
  • *.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
  • *.m 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
  • *.kt files are analyzed with KotlinAnalyzer:
    • 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 (based on imports and package statements)
  • *.bzl 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
  • *.rb files are analyzed with RubyAnalyzer:
    • 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
    • Basic heuristic dependency analysis
  • *.kts files are analyzed with KotlinAnalyzer:
    • 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 (based on imports and package statements)
  • *.pro 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
  • *.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
  • *.command files are analyzed with ShellAnalyzer:
    • 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:58