aws-samples / one-observability-demo
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
cshtml
csproj
txt
mod
dockerignore
patch
properties
npmignore
  • 26 extensions are included in analyses: json, cs, js, go, xml, cshtml, java, css, yaml, gitignore, yml, ts, md, sh, csproj, txt, mod, dockerignore, gradle, py, patch, bat, svg, properties, npmignore, sql
  • 13 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/gradle/wrapper/.*" (Gradle) (2 files).
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (49 files).
    • exclude files with path like ".*[.]min[.]js" (Minimized JS library) (2 files).
    • exclude files with path like ".*/dist/.*" (Distributions) (14 files).
    • exclude files with path like "(?i).*/jquery.*[.]js" (jQuery files) (2 files).
    • exclude files with path like ".*/bootstrap[.](js|css|less|scss|styl)" (Bootstrap) (0 files).
    • exclude files with path like ".*/jquery([^.]*)\.validate(\.unobtrusive)?\.js" (jQuery validation plugin (MS bundles this with asp.net mvc)) (0 files).
    • exclude files with path like ".*jquery[.].*[.]js" (jQuery library) (0 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).
    • exclude files with path like ".*/bootstrap[-].*" (Library) (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.

main10951 LOC (58%) 165 files
test490 LOC (2%) 6 files
generated255 LOC (1%) 1 files
build and deployment888 LOC (4%) 24 files
other6178 LOC (32%) 62 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
cshtml
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 165 files match defined criteria (10,951 lines of code, 100.0% vs. main code):
    • 14 *.yaml files (2,687 lines of code)
    • 28 *.go files (2,498 lines of code)
    • 50 *.cs files (2,450 lines of code)
    • 11 *.ts files (1,004 lines of code)
    • 18 *.java files (774 lines of code)
    • 26 *.cshtml files (656 lines of code)
    • 4 *.css files (394 lines of code)
    • 5 *.yml files (321 lines of code)
    • 6 *.js files (135 lines of code)
    • 3 *.py files (32 lines of code)
  • " *.yaml" is biggest, containing 24.54% of code.
  • " *.py" is smallest, containing 0.29% of code.


*.yaml2687 LOC (24%) 14 files
*.go2498 LOC (22%) 28 files
*.cs2450 LOC (22%) 50 files
*.ts1004 LOC (9%) 11 files
*.java774 LOC (7%) 18 files
*.cshtml656 LOC (5%) 26 files
*.css394 LOC (3%) 4 files
*.yml321 LOC (2%) 5 files
*.js135 LOC (1%) 6 files
*.py32 LOC (<1%) 3 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]est/.*".
    • files with any line of content like ".*/simpletest/.*".
  • 6 files match defined criteria (490 lines of code, 4.5% vs. main code):
    • 4 *.java files (462 lines of code)
    • 2 *.yml files (28 lines of code)
  • " *.java" is biggest, containing 94.29% of code.
  • " *.yml" is smallest, containing 5.71% of code.


*.java462 LOC (94%) 4 files
*.yml28 LOC (5%) 2 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 ".*/package[-]lock[.]json".
  • 1 file matches defined criteria (255 lines of code, 2.3% vs. main code). All matches are in *.json files.


*.json255 LOC (100%) 1 files
Build and Deployment Code
Source code used to configure or support build and deployment process.
csproj
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*/docker[-]compose[.]yml".
    • files with paths like ".*[.]bat".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]gradle".
    • files with paths like ".*[.]sh".
    • files with paths like ".*/package[.]json".
    • files with paths like ".*[.]csproj".
    • files with paths like ".*/package[-]lock[.]json".
  • 24 files match defined criteria (888 lines of code, 8.1% vs. main code):
    • 7 *.sh files (274 lines of code)
    • 7 *.csproj files (210 lines of code)
    • 2 *.bat files (156 lines of code)
    • 4 *.yml files (138 lines of code)
    • 4 *.gradle files (110 lines of code)
  • " *.sh" is biggest, containing 30.86% of code.
  • " *.gradle" is smallest, containing 12.39% of code.


*.sh274 LOC (30%) 7 files
*.csproj210 LOC (23%) 7 files
*.bat156 LOC (17%) 2 files
*.yml138 LOC (15%) 4 files
*.gradle110 LOC (12%) 4 files
Other Code
mod
patch
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 ".*[.]patch".
    • files with paths like ".*[.]properties".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/go[.]mod".
    • files with paths like ".*[.]json".
    • files with paths like ".*/[.]npmignore".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/LICENSE[.][a-z0-9]+".
    • files with paths like ".*[.]svg".
    • files with paths like ".*/[.]dockerignore".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 62 files match defined criteria (6,178 lines of code, 56.4% vs. main code):
    • 43 *.json files (5,729 lines of code)
    • 4 *.mod files (176 lines of code)
    • 8 *.md files (141 lines of code)
    • 2 *.patch files (70 lines of code)
    • 2 *.xml files (34 lines of code)
    • 1 *.sql files (26 lines of code)
    • 2 *.svg files (2 lines of code)
  • " *.json" is biggest, containing 92.73% of code.
  • " *.svg" is smallest, containing 0.03% of code.


*.json5729 LOC (92%) 43 files
*.mod176 LOC (2%) 4 files
*.md141 LOC (2%) 8 files
*.patch70 LOC (1%) 2 files
*.xml34 LOC (<1%) 2 files
*.sql26 LOC (<1%) 1 files
*.svg2 LOC (<1%) 2 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
  • *.cs files are analyzed with CSharpAnalyzer:
    • 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 namespace heuristics)
  • *.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
  • *.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)
  • *.cshtml 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
  • *.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
  • *.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
  • *.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


2022-01-31 16:31