facebookincubator / spectrum
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
properties
podspec
storyboard
plist
pro
  • 25 extensions are included in analyses: h, cpp, java, mm, swift, xml, md, gradle, txt, kt, properties, json, js, svg, podspec, m, yml, gitignore, storyboard, css, xib, plist, bat, sh, pro
  • 6 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (5 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (15 files).
    • exclude files with path like ".*/gradle/wrapper/.*" (Gradle) (1 file).
    • exclude files with path like ".*/(3rd|[Tt]hird)[-_]?[Pp]arty/.*" (Dependencies) (21 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).
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.

main31768 LOC (71%) 578 files
test9633 LOC (21%) 120 files
generated0 LOC (0%) 0 files
build and deployment815 LOC (1%) 27 files
other2451 LOC (5%) 35 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
pro
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 578 files match defined criteria (31,768 lines of code, 100.0% vs. main code):
    • 159 *.cpp files (11,201 lines of code)
    • 246 *.h files (9,859 lines of code)
    • 42 *.mm files (3,718 lines of code)
    • 61 *.java files (3,172 lines of code)
    • 32 *.swift files (1,969 lines of code)
    • 13 *.kt files (899 lines of code)
    • 15 *.xml files (473 lines of code)
    • 5 *.js files (225 lines of code)
    • 3 *.m files (151 lines of code)
    • 1 *.css files (78 lines of code)
    • 1 *.pro files (23 lines of code)
  • " *.cpp" is biggest, containing 35.26% of code.
  • " *.pro" is smallest, containing 0.07% of code.


*.cpp11201 LOC (35%) 159 files
*.h9859 LOC (31%) 246 files
*.mm3718 LOC (11%) 42 files
*.java3172 LOC (9%) 61 files
*.swift1969 LOC (6%) 32 files
*.kt899 LOC (2%) 13 files
*.xml473 LOC (1%) 15 files
*.js225 LOC (<1%) 5 files
*.m151 LOC (<1%) 3 files
*.css78 LOC (<1%) 1 files
*.pro23 LOC (<1%) 1 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
podspec
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*/[Ss]pecs/.*".
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*/src/androidTest/.*".
  • 120 files match defined criteria (9,633 lines of code, 30.3% vs. main code):
    • 67 *.cpp files (7,413 lines of code)
    • 51 *.java files (2,160 lines of code)
    • 1 *.podspec files (43 lines of code)
    • 1 *.h files (17 lines of code)
  • " *.cpp" is biggest, containing 76.95% of code.
  • " *.h" is smallest, containing 0.18% of code.


*.cpp7413 LOC (76%) 67 files
*.java2160 LOC (22%) 51 files
*.podspec43 LOC (<1%) 1 files
*.h17 LOC (<1%) 1 files
Build and Deployment Code
Source code used to configure or support build and deployment process.
podspec
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]podspec".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/package[.]json".
    • files with paths like ".*/AndroidManifest[.]xml".
    • files with paths like ".*[.]gradle".
    • files with paths like ".*[.]bat".
    • files with paths like ".*[.]sh".
  • 27 files match defined criteria (815 lines of code, 2.6% vs. main code):
    • 13 *.gradle files (577 lines of code)
    • 2 *.podspec files (102 lines of code)
    • 11 *.xml files (75 lines of code)
    • 1 *.bat files (61 lines of code)
  • " *.gradle" is biggest, containing 70.8% of code.
  • " *.bat" is smallest, containing 7.48% of code.


*.gradle577 LOC (70%) 13 files
*.podspec102 LOC (12%) 2 files
*.xml75 LOC (9%) 11 files
*.bat61 LOC (7%) 1 files
Other Code
storyboard
txt
properties
plist
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 ".*/[.]gitignore".
    • files with paths like ".*[.]svg".
    • files with paths like ".*[.]storyboard".
    • files with paths like ".*[.]xib".
    • files with paths like ".*[.]plist".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]properties".
    • files with paths like ".*[.]txt".
  • 35 files match defined criteria (2,451 lines of code, 7.7% vs. main code):
    • 2 *.storyboard files (1,410 lines of code)
    • 9 *.txt files (383 lines of code)
    • 6 *.json files (303 lines of code)
    • 4 *.md files (138 lines of code)
    • 9 *.properties files (86 lines of code)
    • 1 *.xib files (77 lines of code)
    • 1 *.plist files (51 lines of code)
    • 3 *.svg files (3 lines of code)
  • " *.storyboard" is biggest, containing 57.53% of code.
  • " *.svg" is smallest, containing 0.12% of code.


*.storyboard1410 LOC (57%) 2 files
*.txt383 LOC (15%) 9 files
*.json303 LOC (12%) 6 files
*.md138 LOC (5%) 4 files
*.properties86 LOC (3%) 9 files
*.xib77 LOC (3%) 1 files
*.plist51 LOC (2%) 1 files
*.svg3 LOC (<1%) 3 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
  • *.mm 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
  • *.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)
  • *.swift files are analyzed with SwiftAnalyzer:
    • 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
  • *.kt files are analyzed with KotlinAnalyzer:
    • 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 (based on imports and package statements)
  • *.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
  • *.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
  • *.m 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
  • *.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
  • *.pro 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-15 05:00