bottlerocket-os / bottlerocket
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
patch
spec
tpl
in
cfg
mod
dockerignore
txt
  • 18 extensions are included in analyses: rs, toml, patch, spec, md, tpl, gitignore, json, in, xml, sh, go, yml, yaml, cfg, mod, dockerignore, txt
  • 9 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (23 files).
    • exclude files with path like ".*/bin/.*" (Binaries for distribution) (2 files).
    • exclude files with path like ".*/cache/.*" (Caches) (1 file).
    • 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 ".*/[Pp]ackages\/.+\.\d+\/.*" (NuGet) (49 files).
    • exclude files with path like ".*/bootstrap[-].*" (Library) (5 files).
    • exclude files with path like ".*[.]txt" (Text files) (0 files).
    • exclude files with path like ".*/sokrates_conventions[.]json" (Sokrates scoping conventions) (1 file).
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.

main49794 LOC (67%) 901 files
test490 LOC (<1%) 6 files
generated0 LOC (0%) 0 files
build and deployment10 LOC (<1%) 3 files
other23694 LOC (32%) 239 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
spec
in
cfg
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 901 files match defined criteria (49,794 lines of code, 100.0% vs. main code):
    • 461 *.rs files (34,195 lines of code)
    • 335 *.toml files (8,026 lines of code)
    • 84 *.spec files (6,086 lines of code)
    • 4 *.go files (871 lines of code)
    • 3 *.yaml files (464 lines of code)
    • 10 *.in files (78 lines of code)
    • 2 *.yml files (51 lines of code)
    • 2 *.cfg files (23 lines of code)
  • " *.rs" is biggest, containing 68.67% of code.
  • " *.cfg" is smallest, containing 0.05% of code.


*.rs34195 LOC (68%) 461 files
*.toml8026 LOC (16%) 335 files
*.spec6086 LOC (12%) 84 files
*.go871 LOC (1%) 4 files
*.yaml464 LOC (<1%) 3 files
*.in78 LOC (<1%) 10 files
*.yml51 LOC (<1%) 2 files
*.cfg23 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 ".*/test_.*".
    • files with paths like ".*/[Tt]ests/.*".
    • files with paths like ".*_test[.].*".
    • files with paths like ".*[-]test[-].*".
    • files with paths like ".*[-]tests[-].*".
    • files with any line of content like ".*/simpletest/.*".
  • 6 files match defined criteria (490 lines of code, 1.0% vs. main code):
    • 2 *.rs files (307 lines of code)
    • 1 *.go files (155 lines of code)
    • 3 *.toml files (28 lines of code)
  • " *.rs" is biggest, containing 62.65% of code.
  • " *.toml" is smallest, containing 5.71% of code.


*.rs307 LOC (62%) 2 files
*.go155 LOC (31%) 1 files
*.toml28 LOC (5%) 3 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 ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]sh".
  • 3 files match defined criteria (10 lines of code, 0.0% vs. main code). All matches are in *.sh files.


*.sh10 LOC (100%) 3 files
Other Code
patch
tpl
mod
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]md".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]json".
    • files with paths like ".*/go[.]mod".
    • files with paths like ".*[.]txt".
    • files with paths like ".*[.]patch".
    • files with paths like ".*/[.]dockerignore".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 239 files match defined criteria (23,694 lines of code, 47.6% vs. main code):
    • 120 *.patch files (16,973 lines of code)
    • 64 *.md files (5,353 lines of code)
    • 8 *.xml files (722 lines of code)
    • 12 *.json files (316 lines of code)
    • 34 *.tpl files (300 lines of code)
    • 1 *.mod files (30 lines of code)
  • " *.patch" is biggest, containing 71.63% of code.
  • " *.mod" is smallest, containing 0.13% of code.


*.patch16973 LOC (71%) 120 files
*.md5353 LOC (22%) 64 files
*.xml722 LOC (3%) 8 files
*.json316 LOC (1%) 12 files
*.tpl300 LOC (1%) 34 files
*.mod30 LOC (<1%) 1 files
Analyzers
Info about analyzers used for source code examinations.
  • *.rs 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
  • *.toml 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
  • *.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
  • *.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
  • *.yaml 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
  • *.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
  • *.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
  • *.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


2022-02-01 04:00