facebook / mcrouter
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
m4
04
txt
rl
  • 14 extensions are included in analyses: h, cpp, json, py, sh, gitignore, m4, thrift, c, md, 04, txt, yml, rl
  • 2 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 ".*[.]m4" (stuff autogenerated by autoconf - still C deps) (10 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.

main64445 LOC (60%) 558 files
test36815 LOC (34%) 257 files
generated0 LOC (0%) 0 files
build and deployment527 LOC (<1%) 21 files
other5498 LOC (5%) 114 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
rl
04
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 558 files match defined criteria (64,445 lines of code, 100.0% vs. main code):
    • 388 *.h files (41,420 lines of code)
    • 156 *.cpp files (20,664 lines of code)
    • 1 *.rl files (1,033 lines of code)
    • 7 *.thrift files (956 lines of code)
    • 3 *.c files (309 lines of code)
    • 2 *.04 files (62 lines of code)
    • 1 *.py files (1 lines of code)
  • " *.h" is biggest, containing 64.27% of code.
  • " *.py" is smallest, containing 0% of code.


*.h41420 LOC (64%) 388 files
*.cpp20664 LOC (32%) 156 files
*.rl1033 LOC (1%) 1 files
*.thrift956 LOC (1%) 7 files
*.c309 LOC (<1%) 3 files
*.0462 LOC (<1%) 2 files
*.py1 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 ".*/test_.*".
    • files with paths like ".*_test[.].*".
  • 257 files match defined criteria (36,815 lines of code, 57.1% vs. main code):
    • 121 *.cpp files (20,555 lines of code)
    • 63 *.h files (10,572 lines of code)
    • 66 *.py files (5,417 lines of code)
    • 3 *.thrift files (210 lines of code)
    • 4 *.sh files (61 lines of code)
  • " *.cpp" is biggest, containing 55.83% of code.
  • " *.sh" is smallest, containing 0.17% of code.


*.cpp20555 LOC (55%) 121 files
*.h10572 LOC (28%) 63 files
*.py5417 LOC (14%) 66 files
*.thrift210 LOC (<1%) 3 files
*.sh61 LOC (<1%) 4 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 ".*[.]sh".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
  • 21 files match defined criteria (527 lines of code, 0.8% vs. main code). All matches are in *.sh files.


*.sh527 LOC (100%) 21 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 ".*/[.]gitignore".
  • 114 files match defined criteria (5,498 lines of code, 8.5% vs. main code):
    • 111 *.json files (5,407 lines of code)
    • 3 *.md files (91 lines of code)
  • " *.json" is biggest, containing 98.34% of code.
  • " *.md" is smallest, containing 1.66% of code.


*.json5407 LOC (98%) 111 files
*.md91 LOC (1%) 3 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
  • *.rl 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
  • *.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
  • *.c files are analyzed with CStyleAnalyzer:
    • 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
  • *.04 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
  • *.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


2022-04-14 22:52