kubernetes / test-infra
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
libsonnet
mod
gitattributes
mk
dockerignore
  • 25 extensions are included in analyses: go, yaml, md, sh, py, ts, html, txt, json, css, gitignore, libsonnet, js, jsonnet, bzl, svg, xml, jinja, mod, gitattributes, mk, toml, dockerignore, yml, tf
  • 11 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (27 files).
    • exclude files with path like ".*/(3rd|[Tt]hird)[-_]?[Pp]arty/.*" (Dependencies) (29 files).
    • exclude files with path like ".*/octicons[.]css" (Octicons) (1 file).
    • exclude files with path like ".*/testdata/.*" (Test data) (76 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (16 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 ".*\.d\.ts" (Typescript definition files) (3 files).
    • exclude files with path like ".*/cache/.*" (Caches) (2 files).
    • exclude files with path like ".*/sokrates_conventions[.]json" (Sokrates scoping conventions) (1 file).
    • exclude files with path like ".*[.]txt" (Text files) (13 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.

main311509 LOC (63%) 1365 files
test158496 LOC (32%) 374 files
generated930 LOC (<1%) 1 files
build and deployment6143 LOC (1%) 116 files
other12719 LOC (2%) 170 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 1365 files match defined criteria (311,509 lines of code, 100.0% vs. main code):
    • 669 *.yaml files (194,793 lines of code)
    • 510 *.go files (89,922 lines of code)
    • 67 *.py files (8,756 lines of code)
    • 7 *.bzl files (6,322 lines of code)
    • 32 *.ts files (4,739 lines of code)
    • 36 *.html files (1,986 lines of code)
    • 16 *.css files (1,618 lines of code)
    • 10 *.js files (1,568 lines of code)
    • 11 *.jsonnet files (1,423 lines of code)
    • 4 *.jinja files (265 lines of code)
    • 1 *.tf files (88 lines of code)
    • 2 *.toml files (29 lines of code)
  • " *.yaml" is biggest, containing 62.53% of code.
  • " *.toml" is smallest, containing 0.01% of code.


*.yaml194793 LOC (62%) 669 files
*.go89922 LOC (28%) 510 files
*.py8756 LOC (2%) 67 files
*.bzl6322 LOC (2%) 7 files
*.ts4739 LOC (1%) 32 files
*.html1986 LOC (<1%) 36 files
*.css1618 LOC (<1%) 16 files
*.js1568 LOC (<1%) 10 files
*.jsonnet1423 LOC (<1%) 11 files
*.jinja265 LOC (<1%) 4 files
*.tf88 LOC (<1%) 1 files
*.toml29 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 ".*_tests[.].*".
    • files with paths like ".*_test[.].*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*/e2e/.*".
    • files with paths like ".*[-]test[-].*".
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*/[Tt]ests/.*".
    • files with any line of content like ".*/simpletest/.*".
  • 374 files match defined criteria (158,496 lines of code, 50.9% vs. main code):
    • 293 *.go files (129,074 lines of code)
    • 40 *.yaml files (24,409 lines of code)
    • 30 *.py files (4,298 lines of code)
    • 6 *.sh files (362 lines of code)
    • 2 *.ts files (241 lines of code)
    • 2 *.js files (77 lines of code)
    • 1 *.bzl files (35 lines of code)
  • " *.go" is biggest, containing 81.44% of code.
  • " *.bzl" is smallest, containing 0.02% of code.


*.go129074 LOC (81%) 293 files
*.yaml24409 LOC (15%) 40 files
*.py4298 LOC (2%) 30 files
*.sh362 LOC (<1%) 6 files
*.ts241 LOC (<1%) 2 files
*.js77 LOC (<1%) 2 files
*.bzl35 LOC (<1%) 1 files
Generated Code
Automatically generated files, not manually changed after generation.
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*/generated/.*".
  • 1 file matches defined criteria (930 lines of code, 0.3% vs. main code). All matches are in *.yaml files.


*.yaml930 LOC (100%) 1 files
Build and Deployment Code
Source code used to configure or support build and deployment process.
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 ".*/[.]gitattributes".
    • files with paths like ".*/package[.]json".
  • 116 files match defined criteria (6,143 lines of code, 2.0% vs. main code):
    • 114 *.sh files (6,069 lines of code)
    • 2 *.mk files (74 lines of code)
  • " *.sh" is biggest, containing 98.8% of code.
  • " *.mk" is smallest, containing 1.2% of code.


*.sh6069 LOC (98%) 114 files
*.mk74 LOC (1%) 2 files
Other Code
libsonnet
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 ".*[.]json".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/go[.]mod".
    • files with paths like ".*/[.]dockerignore".
    • files with paths like ".*[.]svg".
    • files with paths like ".*/[Ee]xamples/.*".
    • files with paths like ".*[.]libsonnet".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 170 files match defined criteria (12,719 lines of code, 4.1% vs. main code):
    • 130 *.md files (9,127 lines of code)
    • 20 *.json files (2,764 lines of code)
    • 17 *.libsonnet files (702 lines of code)
    • 3 *.mod files (126 lines of code)
  • " *.md" is biggest, containing 71.76% of code.
  • " *.mod" is smallest, containing 0.99% of code.


*.md9127 LOC (71%) 130 files
*.json2764 LOC (21%) 20 files
*.libsonnet702 LOC (5%) 17 files
*.mod126 LOC (<1%) 3 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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
  • *.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
  • *.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
  • *.bzl 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
  • *.ts files are analyzed with TypeScriptAnalyzer:
    • 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
  • *.html files are analyzed with HtmlAnalyzer:
    • 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
  • *.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
  • *.jsonnet 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
  • *.jinja files are analyzed with HtmlAnalyzer:
    • 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
  • *.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


2022-02-03 08:57