facebookresearch / fbpcs
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
properties
  • 16 extensions are included in analyses: py, cpp, h, json, tf, sh, md, java, hpp, txt, yml, gradle, cmake, gitignore, xml, properties
  • 6 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/gradle/wrapper/.*" (Gradle) (1 file).
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (4 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (2 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).
    • exclude files with path like ".*[.]txt" (Text files) (4 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.

main21646 LOC (49%) 309 files
test10677 LOC (24%) 102 files
generated0 LOC (0%) 0 files
build and deployment1065 LOC (2%) 14 files
other10562 LOC (24%) 61 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 ".*".
  • 309 files match defined criteria (21,646 lines of code, 100.0% vs. main code):
    • 117 *.py files (7,983 lines of code)
    • 67 *.cpp files (6,064 lines of code)
    • 83 *.h files (4,045 lines of code)
    • 7 *.hpp files (1,827 lines of code)
    • 25 *.tf files (1,120 lines of code)
    • 7 *.java files (511 lines of code)
    • 1 *.yml files (50 lines of code)
    • 2 *.cmake files (46 lines of code)
  • " *.py" is biggest, containing 36.88% of code.
  • " *.cmake" is smallest, containing 0.21% of code.


*.py7983 LOC (36%) 117 files
*.cpp6064 LOC (28%) 67 files
*.h4045 LOC (18%) 83 files
*.hpp1827 LOC (8%) 7 files
*.tf1120 LOC (5%) 25 files
*.java511 LOC (2%) 7 files
*.yml50 LOC (<1%) 1 files
*.cmake46 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 ".*/[Tt]est/.*".
    • files with paths like ".*_test[.].*".
  • 102 files match defined criteria (10,677 lines of code, 49.3% vs. main code):
    • 43 *.py files (5,969 lines of code)
    • 43 *.cpp files (3,805 lines of code)
    • 7 *.h files (584 lines of code)
    • 7 *.sh files (259 lines of code)
    • 1 *.yml files (52 lines of code)
    • 1 *.java files (8 lines of code)
  • " *.py" is biggest, containing 55.91% of code.
  • " *.java" is smallest, containing 0.07% of code.


*.py5969 LOC (55%) 43 files
*.cpp3805 LOC (35%) 43 files
*.h584 LOC (5%) 7 files
*.sh259 LOC (2%) 7 files
*.yml52 LOC (<1%) 1 files
*.java8 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 ".*[.]sh".
    • files with paths like ".*[.]gradle".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
  • 14 files match defined criteria (1,065 lines of code, 4.9% vs. main code):
    • 12 *.sh files (1,045 lines of code)
    • 2 *.gradle files (20 lines of code)
  • " *.sh" is biggest, containing 98.12% of code.
  • " *.gradle" is smallest, containing 1.88% of code.


*.sh1045 LOC (98%) 12 files
*.gradle20 LOC (1%) 2 files
Other Code
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 ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]json".
    • files with paths like ".*[.]properties".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 61 files match defined criteria (10,562 lines of code, 48.8% vs. main code):
    • 52 *.json files (10,113 lines of code)
    • 8 *.md files (411 lines of code)
    • 1 *.xml files (38 lines of code)
  • " *.json" is biggest, containing 95.75% of code.
  • " *.xml" is smallest, containing 0.36% of code.


*.json10113 LOC (95%) 52 files
*.md411 LOC (3%) 8 files
*.xml38 LOC (<1%) 1 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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
  • *.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
  • *.tf 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
  • *.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)
  • *.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
  • *.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


2022-01-25 20:18