facebook / fboss
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
cmake
txt
clang-format
spec
  • 19 extensions are included in analyses: cpp, h, cmake, py, thrift, hpp, rst, md, sh, json, txt, gitignore, svg, clang-format, yml, asm, css, c, spec
  • 2 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (6 files).
    • exclude files with path like ".*/deps/.*" (Dependencies) (3 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.

main225558 LOC (65%) 1797 files
test106223 LOC (30%) 663 files
generated0 LOC (0%) 0 files
build and deployment300 LOC (<1%) 8 files
other10754 LOC (3%) 54 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
cmake
spec
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 1797 files match defined criteria (225,558 lines of code, 100.0% vs. main code):
    • 764 *.cpp files (134,131 lines of code)
    • 782 *.h files (58,375 lines of code)
    • 35 *.hpp files (11,566 lines of code)
    • 62 *.py files (10,957 lines of code)
    • 94 *.cmake files (6,284 lines of code)
    • 53 *.thrift files (3,946 lines of code)
    • 2 *.asm files (138 lines of code)
    • 1 *.c files (74 lines of code)
    • 1 *.spec files (44 lines of code)
    • 2 *.yml files (32 lines of code)
    • 1 *.css files (11 lines of code)
  • " *.cpp" is biggest, containing 59.47% of code.
  • " *.css" is smallest, containing 0% of code.


*.cpp134131 LOC (59%) 764 files
*.h58375 LOC (25%) 782 files
*.hpp11566 LOC (5%) 35 files
*.py10957 LOC (4%) 62 files
*.cmake6284 LOC (2%) 94 files
*.thrift3946 LOC (1%) 53 files
*.asm138 LOC (<1%) 2 files
*.c74 LOC (<1%) 1 files
*.spec44 LOC (<1%) 1 files
*.yml32 LOC (<1%) 2 files
*.css11 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 ".*/[Tt]ests/.*".
    • files with paths like ".*_test[.].*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*_tests[.].*".
    • files with paths like ".*/[Ss]pecs/.*".
  • 663 files match defined criteria (106,223 lines of code, 47.1% vs. main code):
    • 505 *.cpp files (98,464 lines of code)
    • 133 *.h files (6,713 lines of code)
    • 22 *.py files (1,017 lines of code)
    • 1 *.thrift files (16 lines of code)
    • 2 *.sh files (13 lines of code)
  • " *.cpp" is biggest, containing 92.7% of code.
  • " *.sh" is smallest, containing 0.01% of code.


*.cpp98464 LOC (92%) 505 files
*.h6713 LOC (6%) 133 files
*.py1017 LOC (<1%) 22 files
*.thrift16 LOC (<1%) 1 files
*.sh13 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 ".*[.]sh".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
  • 8 files match defined criteria (300 lines of code, 0.1% vs. main code). All matches are in *.sh files.


*.sh300 LOC (100%) 8 files
Other Code
txt
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]md".
    • files with paths like ".*[.]txt".
    • files with paths like ".*[.]json".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.](rst|rest|resttxt|rsttxt)".
    • files with paths like ".*[.]svg".
  • 54 files match defined criteria (10,754 lines of code, 4.8% vs. main code):
    • 8 *.json files (5,143 lines of code)
    • 18 *.md files (1,801 lines of code)
    • 23 *.rst files (1,554 lines of code)
    • 3 *.svg files (1,229 lines of code)
    • 2 *.txt files (1,027 lines of code)
  • " *.json" is biggest, containing 47.82% of code.
  • " *.txt" is smallest, containing 9.55% of code.


*.json5143 LOC (47%) 8 files
*.md1801 LOC (16%) 18 files
*.rst1554 LOC (14%) 23 files
*.svg1229 LOC (11%) 3 files
*.txt1027 LOC (9%) 2 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
  • *.hpp 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
  • *.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
  • *.asm 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
  • *.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
  • *.spec 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
  • *.yml files are analyzed with YamlAnalyzer:
    • 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


2022-04-14 23:03