facebook / openbmc
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
bb
txt
patch
cfg
mak
cgi
in
clang-format
mod
mk
diff
  • 26 extensions are included in analyses: py, sh, c, bb, yml, h, cpp, json, go, txt, patch, inc, cfg, md, hpp, gitignore, mak, cgi, xml, in, clang-format, rst, mod, mk, diff, js
  • 2 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (8 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (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.

main498904 LOC (80%) 2980 files
test47822 LOC (7%) 787 files
generated0 LOC (0%) 0 files
build and deployment32562 LOC (5%) 788 files
other38632 LOC (6%) 348 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
bb
cfg
in
cgi
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 2980 files match defined criteria (498,904 lines of code, 100.0% vs. main code):
    • 637 *.c files (335,468 lines of code)
    • 475 *.py files (44,063 lines of code)
    • 489 *.yml files (34,978 lines of code)
    • 470 *.h files (32,789 lines of code)
    • 222 *.cpp files (26,837 lines of code)
    • 515 *.bb files (18,249 lines of code)
    • 76 *.go files (4,266 lines of code)
    • 44 *.inc files (814 lines of code)
    • 18 *.hpp files (606 lines of code)
    • 27 *.cfg files (487 lines of code)
    • 2 *.xml files (260 lines of code)
    • 2 *.in files (44 lines of code)
    • 1 *.js files (25 lines of code)
    • 2 *.cgi files (18 lines of code)
  • " *.c" is biggest, containing 67.24% of code.
  • " *.cgi" is smallest, containing 0% of code.


*.c335468 LOC (67%) 637 files
*.py44063 LOC (8%) 475 files
*.yml34978 LOC (7%) 489 files
*.h32789 LOC (6%) 470 files
*.cpp26837 LOC (5%) 222 files
*.bb18249 LOC (3%) 515 files
*.go4266 LOC (<1%) 76 files
*.inc814 LOC (<1%) 44 files
*.hpp606 LOC (<1%) 18 files
*.cfg487 LOC (<1%) 27 files
*.xml260 LOC (<1%) 2 files
*.in44 LOC (<1%) 2 files
*.js25 LOC (<1%) 1 files
*.cgi18 LOC (<1%) 2 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]ests/.*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*_test[.].*".
    • files with paths like ".*_tests[.].*".
    • files with paths like ".*/test[-]data/.*".
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*[-]test[-].*".
  • 787 files match defined criteria (47,822 lines of code, 9.6% vs. main code):
    • 673 *.py files (31,550 lines of code)
    • 47 *.go files (9,348 lines of code)
    • 42 *.cpp files (5,014 lines of code)
    • 8 *.c files (1,424 lines of code)
    • 10 *.h files (413 lines of code)
    • 7 *.sh files (73 lines of code)
  • " *.py" is biggest, containing 65.97% of code.
  • " *.sh" is smallest, containing 0.15% of code.


*.py31550 LOC (65%) 673 files
*.go9348 LOC (19%) 47 files
*.cpp5014 LOC (10%) 42 files
*.c1424 LOC (2%) 8 files
*.h413 LOC (<1%) 10 files
*.sh73 LOC (<1%) 7 files
Build and Deployment Code
Source code used to configure or support build and deployment process.
mak
mk
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".
    • files with paths like ".*[.]mk".
    • files with paths like ".*[.]mak".
  • 788 files match defined criteria (32,562 lines of code, 6.5% vs. main code):
    • 785 *.sh files (32,405 lines of code)
    • 2 *.mak files (108 lines of code)
    • 1 *.mk files (49 lines of code)
  • " *.sh" is biggest, containing 99.52% of code.
  • " *.mk" is smallest, containing 0.15% of code.


*.sh32405 LOC (99%) 785 files
*.mak108 LOC (<1%) 2 files
*.mk49 LOC (<1%) 1 files
Other Code
patch
txt
diff
mod
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 ".*[.]txt".
    • files with paths like ".*/[Dd]ocumentation/.*".
    • files with paths like ".*[.](rst|rest|resttxt|rsttxt)".
    • files with paths like ".*[.]patch".
    • files with paths like ".*/go[.]mod".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]diff".
    • files with paths like ".*/LICENSE[.][a-z0-9]+".
  • 348 files match defined criteria (38,632 lines of code, 7.7% vs. main code):
    • 211 *.json files (29,211 lines of code)
    • 53 *.patch files (4,462 lines of code)
    • 16 *.md files (2,496 lines of code)
    • 64 *.txt files (1,568 lines of code)
    • 1 *.diff files (745 lines of code)
    • 2 *.rst files (148 lines of code)
    • 1 *.mod files (2 lines of code)
  • " *.json" is biggest, containing 75.61% of code.
  • " *.mod" is smallest, containing 0.01% of code.


*.json29211 LOC (75%) 211 files
*.patch4462 LOC (11%) 53 files
*.md2496 LOC (6%) 16 files
*.txt1568 LOC (4%) 64 files
*.diff745 LOC (1%) 1 files
*.rst148 LOC (<1%) 2 files
*.mod2 LOC (<1%) 1 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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
  • *.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
  • *.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
  • *.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
  • *.bb 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
  • *.go files are analyzed with GoLangAnalyzer:
    • 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
  • *.inc files are analyzed with PhpAnalyzer:
    • 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
  • *.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
  • *.cfg files are analyzed with CfgAnalyzer:
    • 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
  • *.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
  • *.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
  • *.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
  • *.cgi 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:02