facebook / mariana-trench
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
sexp
cmake
txt
properties
prettierignore
  • 20 extensions are included in analyses: json, cpp, java, h, sexp, md, py, js, gitignore, gradle, cmake, yml, css, txt, sh, xml, properties, svg, bat, prettierignore
  • 4 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (12 files).
    • exclude files with path like ".*/gradle/wrapper/.*" (Gradle) (1 file).
    • 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.

main23977 LOC (16%) 204 files
test22873 LOC (15%) 229 files
generated0 LOC (0%) 0 files
build and deployment8 LOC (<1%) 2 files
other97275 LOC (67%) 398 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
cmake
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 204 files match defined criteria (23,977 lines of code, 100.0% vs. main code):
    • 86 *.cpp files (14,823 lines of code)
    • 103 *.h files (7,174 lines of code)
    • 8 *.py files (1,391 lines of code)
    • 3 *.cmake files (445 lines of code)
    • 4 *.java files (144 lines of code)
  • " *.cpp" is biggest, containing 61.82% of code.
  • " *.java" is smallest, containing 0.6% of code.


*.cpp14823 LOC (61%) 86 files
*.h7174 LOC (29%) 103 files
*.py1391 LOC (5%) 8 files
*.cmake445 LOC (1%) 3 files
*.java144 LOC (<1%) 4 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
sexp
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*/[Tt]ests/.*".
    • files with paths like ".*/test_.*".
  • 229 files match defined criteria (22,873 lines of code, 95.4% vs. main code):
    • 50 *.cpp files (19,468 lines of code)
    • 122 *.java files (2,352 lines of code)
    • 56 *.sexp files (984 lines of code)
    • 1 *.h files (69 lines of code)
  • " *.cpp" is biggest, containing 85.11% of code.
  • " *.h" is smallest, containing 0.3% of code.


*.cpp19468 LOC (85%) 50 files
*.java2352 LOC (10%) 122 files
*.sexp984 LOC (4%) 56 files
*.h69 LOC (<1%) 1 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 ".*[.]gradle".
    • files with paths like ".*/AndroidManifest[.]xml".
    • files with paths like ".*[.]bat".
    • files with paths like ".*/package[.]json".
    • files with paths like ".*[.]sh".
  • 2 files match defined criteria (8 lines of code, 0.0% vs. main code). All matches are in *.sh files.


*.sh8 LOC (100%) 2 files
Other Code
txt
properties
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 ".*/[.]gitignore".
    • files with paths like ".*/[Dd]ocumentation/.*".
    • files with paths like ".*[.]properties".
    • files with paths like ".*/[.]prettierignore".
    • files with paths like ".*[.]txt".
  • 398 files match defined criteria (97,275 lines of code, 405.7% vs. main code):
    • 368 *.json files (95,486 lines of code)
    • 12 *.md files (1,108 lines of code)
    • 4 *.js files (214 lines of code)
    • 1 *.txt files (184 lines of code)
    • 4 *.java files (89 lines of code)
    • 1 *.bat files (61 lines of code)
    • 2 *.css files (49 lines of code)
    • 3 *.gradle files (45 lines of code)
    • 2 *.xml files (36 lines of code)
    • 1 *.properties files (3 lines of code)
  • " *.json" is biggest, containing 98.16% of code.
  • " *.properties" is smallest, containing 0% of code.


*.json95486 LOC (98%) 368 files
*.md1108 LOC (1%) 12 files
*.js214 LOC (<1%) 4 files
*.txt184 LOC (<1%) 1 files
*.java89 LOC (<1%) 4 files
*.bat61 LOC (<1%) 1 files
*.css49 LOC (<1%) 2 files
*.gradle45 LOC (<1%) 3 files
*.xml36 LOC (<1%) 2 files
*.properties3 LOC (<1%) 1 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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
  • *.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
  • *.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
  • *.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)


2022-04-15 00:47