facebook / CacheLib
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
txt
cmake
in
clang-format
plt
gitmodules
prettierignore
  • 20 extensions are included in analyses: h, cpp, json, md, sh, txt, thrift, js, rs, cmake, yml, css, in, gitignore, clang-format, toml, plt, gitmodules, prettierignore, yaml
  • 5 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (18 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (43 files).
    • exclude files with path like ".*/cache/.*" (Caches) (9 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.

main45545 LOC (35%) 357 files
test31824 LOC (25%) 131 files
generated0 LOC (0%) 0 files
build and deployment620 LOC (<1%) 11 files
other49081 LOC (38%) 106 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
cmake
plt
in
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 357 files match defined criteria (45,545 lines of code, 100.0% vs. main code):
    • 206 *.h files (24,842 lines of code)
    • 120 *.cpp files (17,254 lines of code)
    • 6 *.rs files (1,549 lines of code)
    • 6 *.cmake files (902 lines of code)
    • 5 *.js files (541 lines of code)
    • 9 *.thrift files (284 lines of code)
    • 2 *.css files (92 lines of code)
    • 1 *.plt files (41 lines of code)
    • 1 *.in files (22 lines of code)
    • 1 *.toml files (18 lines of code)
  • " *.h" is biggest, containing 54.54% of code.
  • " *.toml" is smallest, containing 0.04% of code.


*.h24842 LOC (54%) 206 files
*.cpp17254 LOC (37%) 120 files
*.rs1549 LOC (3%) 6 files
*.cmake902 LOC (1%) 6 files
*.js541 LOC (1%) 5 files
*.thrift284 LOC (<1%) 9 files
*.css92 LOC (<1%) 2 files
*.plt41 LOC (<1%) 1 files
*.in22 LOC (<1%) 1 files
*.toml18 LOC (<1%) 1 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
in
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*/[Tt]ests/.*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*[.][Tt]ests[.].*".
    • files with paths like ".*[.]tests[.].*".
    • files with paths like ".*_test[.].*".
  • 131 files match defined criteria (31,824 lines of code, 69.9% vs. main code):
    • 104 *.cpp files (23,486 lines of code)
    • 24 *.h files (8,213 lines of code)
    • 1 *.in files (84 lines of code)
    • 2 *.thrift files (41 lines of code)
  • " *.cpp" is biggest, containing 73.8% of code.
  • " *.thrift" is smallest, containing 0.13% of code.


*.cpp23486 LOC (73%) 104 files
*.h8213 LOC (25%) 24 files
*.in84 LOC (<1%) 1 files
*.thrift41 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 ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/package[.]json".
    • files with paths like ".*/[.]gitmodules".
    • files with paths like ".*[.]sh".
  • 11 files match defined criteria (620 lines of code, 1.4% vs. main code). All matches are in *.sh files.


*.sh620 LOC (100%) 11 files
Other Code
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 ".*/[.]prettierignore".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[Ee]xamples/.*".
  • 106 files match defined criteria (49,081 lines of code, 107.8% vs. main code):
    • 79 *.json files (47,543 lines of code)
    • 11 *.txt files (937 lines of code)
    • 12 *.md files (450 lines of code)
    • 2 *.cpp files (121 lines of code)
    • 2 *.sh files (30 lines of code)
  • " *.json" is biggest, containing 96.87% of code.
  • " *.sh" is smallest, containing 0.06% of code.


*.json47543 LOC (96%) 79 files
*.txt937 LOC (1%) 11 files
*.md450 LOC (<1%) 12 files
*.cpp121 LOC (<1%) 2 files
*.sh30 LOC (<1%) 2 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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
  • *.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
  • *.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
  • *.cmake 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
  • *.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
  • *.thrift files are analyzed with ThriftAnalyzer:
    • 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
  • *.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
  • *.plt 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
  • *.in 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
  • *.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


2022-04-15 00:46