facebook / litho
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
mdx
properties
pro
txt
hs
clang-format
prettierignore
  • 25 extensions are included in analyses: java, html, kt, xml, md, gradle, mdx, properties, h, cpp, svg, bat, pro, sh, js, yml, txt, bzl, gitignore, scss, json, css, hs, clang-format, prettierignore
  • 6 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/testdata/.*" (Test data) (86 files).
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (11 files).
    • exclude files with path like ".*/proguard[-]rules[.]pro" (ProGuard) (8 files).
    • exclude files with path like ".*/gradle/wrapper/.*" (Gradle) (12 files).
    • exclude files with path like ".*/[Jj]avadoc/.*" (Generated documentation) (1021 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (123 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.

main128330 LOC (55%) 1434 files
test74757 LOC (32%) 463 files
generated0 LOC (0%) 0 files
build and deployment3373 LOC (1%) 134 files
other22863 LOC (9%) 471 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
hs
pro
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 1434 files match defined criteria (128,330 lines of code, 100.0% vs. main code):
    • 1,142 *.java files (107,510 lines of code)
    • 131 *.kt files (7,488 lines of code)
    • 17 *.cpp files (5,944 lines of code)
    • 102 *.xml files (2,927 lines of code)
    • 29 *.h files (2,874 lines of code)
    • 6 *.js files (695 lines of code)
    • 3 *.bzl files (473 lines of code)
    • 2 *.scss files (228 lines of code)
    • 1 *.hs files (178 lines of code)
    • 1 *.pro files (13 lines of code)
  • " *.java" is biggest, containing 83.78% of code.
  • " *.pro" is smallest, containing 0.01% of code.


*.java107510 LOC (83%) 1142 files
*.kt7488 LOC (5%) 131 files
*.cpp5944 LOC (4%) 17 files
*.xml2927 LOC (2%) 102 files
*.h2874 LOC (2%) 29 files
*.js695 LOC (<1%) 6 files
*.bzl473 LOC (<1%) 3 files
*.scss228 LOC (<1%) 2 files
*.hs178 LOC (<1%) 1 files
*.pro13 LOC (<1%) 1 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*[-]tests/.*".
    • files with paths like ".*/src/androidTest/.*".
    • files with paths like ".*/[Ss]pecs/.*".
    • files with paths like ".*/test_.*".
  • 463 files match defined criteria (74,757 lines of code, 58.3% vs. main code):
    • 408 *.java files (66,447 lines of code)
    • 48 *.kt files (8,162 lines of code)
    • 5 *.xml files (80 lines of code)
    • 2 *.gradle files (68 lines of code)
  • " *.java" is biggest, containing 88.88% of code.
  • " *.gradle" is smallest, containing 0.09% of code.


*.java66447 LOC (88%) 408 files
*.kt8162 LOC (10%) 48 files
*.xml80 LOC (<1%) 5 files
*.gradle68 LOC (<1%) 2 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 ".*[.]gradle".
    • files with paths like ".*/AndroidManifest[.]xml".
    • files with paths like ".*[.]sh".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]bat".
    • files with paths like ".*/package[.]json".
  • 134 files match defined criteria (3,373 lines of code, 2.6% vs. main code):
    • 73 *.gradle files (1,975 lines of code)
    • 12 *.bat files (732 lines of code)
    • 41 *.xml files (481 lines of code)
    • 8 *.sh files (185 lines of code)
  • " *.gradle" is biggest, containing 58.55% of code.
  • " *.sh" is smallest, containing 5.48% of code.


*.gradle1975 LOC (58%) 73 files
*.bat732 LOC (21%) 12 files
*.xml481 LOC (14%) 41 files
*.sh185 LOC (5%) 8 files
Other Code
properties
txt
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]md".
    • files with paths like ".*[.]properties".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]svg".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]json".
    • files with paths like ".*/[Ee]xamples/.*".
    • files with paths like ".*/[.]prettierignore".
    • files with paths like ".*/[Ss]amples/.*".
    • files with paths like ".*[.]mdx".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[Dd]ocumentation/.*".
  • 471 files match defined criteria (22,863 lines of code, 17.8% vs. main code):
    • 240 *.java files (11,901 lines of code)
    • 161 *.kt files (6,655 lines of code)
    • 11 *.svg files (1,721 lines of code)
    • 15 *.md files (1,560 lines of code)
    • 39 *.properties files (816 lines of code)
    • 3 *.txt files (110 lines of code)
    • 2 *.json files (100 lines of code)
  • " *.java" is biggest, containing 52.05% of code.
  • " *.json" is smallest, containing 0.44% of code.


*.java11901 LOC (52%) 240 files
*.kt6655 LOC (29%) 161 files
*.svg1721 LOC (7%) 11 files
*.md1560 LOC (6%) 15 files
*.properties816 LOC (3%) 39 files
*.txt110 LOC (<1%) 3 files
*.json100 LOC (<1%) 2 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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)
  • *.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)
  • *.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
  • *.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
  • *.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
  • *.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
  • *.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
  • *.scss files are analyzed with ScssAnalyzer:
    • 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
  • *.hs 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
  • *.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


2022-04-14 23:09