GoogleCloudPlatform / cloud-foundation-toolkit
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
hcl
txt
rego
mod
proto
bats
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.

main20266 LOC (61%) 205 files
test7273 LOC (22%) 81 files
generated0 LOC (0%) 0 files
build and deployment1280 LOC (3%) 33 files
other4092 LOC (12%) 80 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
proto
rego
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 205 files match defined criteria (20,266 LOC, 100.0% vs. main code):
    • 100 *.go files (13,483 LOC)
    • 85 *.tf files (4,540 LOC)
    • 3 *.proto files (875 LOC)
    • 8 *.yaml files (593 LOC)
    • 5 *.rego files (517 LOC)
    • 4 *.py files (258 LOC)
  • " *.go" is biggest, containing 66.53% of LOC.
  • " *.py" is smallest, containing 1.27% of LOC.


*.go13483 LOC (66%) 100 files
*.tf4540 LOC (22%) 85 files
*.proto875 LOC (4%) 3 files
*.yaml593 LOC (2%) 8 files
*.rego517 LOC (2%) 5 files
*.py258 LOC (1%) 4 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
bats
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*_test[.].*".
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*/test[.].*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*[-]tests/.*".
    • files with paths like ".*/[Tt]ests/.*".
  • 81 files match defined criteria (7,273 LOC, 35.9% vs. main code):
    • 60 *.go files (6,675 LOC)
    • 8 *.tf files (234 LOC)
    • 7 *.yaml files (144 LOC)
    • 2 *.bats files (106 LOC)
    • 1 *.py files (66 LOC)
    • 3 *.sh files (48 LOC)
  • " *.go" is biggest, containing 91.78% of LOC.
  • " *.sh" is smallest, containing 0.66% of LOC.


*.go6675 LOC (91%) 60 files
*.tf234 LOC (3%) 8 files
*.yaml144 LOC (1%) 7 files
*.bats106 LOC (1%) 2 files
*.py66 LOC (<1%) 1 file
*.sh48 LOC (<1%) 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".
  • 33 files match defined criteria (1,280 LOC, 6.3% vs. main code). All matches are in *.sh files.


*.sh1280 LOC (100%) 33 files
Other Code
mod
txt
rego
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]json".
    • files with paths like ".*[.]md".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/go[.]mod".
    • files with paths like ".*/[Ee]xamples/.*".
    • files with paths like ".*[.]txt".
  • 80 files match defined criteria (4,092 LOC, 20.2% vs. main code):
    • 4 *.json files (1,368 LOC)
    • 20 *.md files (1,159 LOC)
    • 27 *.tf files (651 LOC)
    • 5 *.mod files (492 LOC)
    • 8 *.yaml files (131 LOC)
    • 9 *.txt files (117 LOC)
    • 3 *.rego files (115 LOC)
    • 4 *.go files (59 LOC)
  • " *.json" is biggest, containing 33.43% of LOC.
  • " *.go" is smallest, containing 1.44% of LOC.


*.json1368 LOC (33%) 4 files
*.md1159 LOC (28%) 20 files
*.tf651 LOC (15%) 27 files
*.mod492 LOC (12%) 5 files
*.yaml131 LOC (3%) 8 files
*.txt117 LOC (2%) 9 files
*.rego115 LOC (2%) 3 files
*.go59 LOC (1%) 4 files
Analyzers
Info about analyzers used for source code examinations.


2025-05-04 14:44