aws-samples / serverless-patterns
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
npmignore
eslintignore
csproj
  • 17 extensions are included in analyses: json, md, ts, py, js, yaml, gitignore, txt, npmignore, yml, bat, graphql, eslintignore, cs, html, csproj, sql
  • 7 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (107 files).
    • exclude files with path like ".*/bin/.*" (Binaries for distribution) (35 files).
    • exclude files with path like ".*/dist/.*" (Distributions) (4 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) (48 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.

main17295 LOC (47%) 418 files
test297 LOC (<1%) 37 files
generated13 LOC (<1%) 1 files
build and deployment207 LOC (<1%) 18 files
other18445 LOC (50%) 439 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 ".*".
  • 418 files match defined criteria (17,295 lines of code, 100.0% vs. main code):
    • 86 *.yaml files (6,497 lines of code)
    • 93 *.ts files (4,454 lines of code)
    • 103 *.py files (2,456 lines of code)
    • 16 *.yml files (1,800 lines of code)
    • 99 *.js files (1,606 lines of code)
    • 7 *.cs files (230 lines of code)
    • 10 *.graphql files (228 lines of code)
    • 4 *.html files (24 lines of code)
  • " *.yaml" is biggest, containing 37.57% of code.
  • " *.html" is smallest, containing 0.14% of code.


*.yaml6497 LOC (37%) 86 files
*.ts4454 LOC (25%) 93 files
*.py2456 LOC (14%) 103 files
*.yml1800 LOC (10%) 16 files
*.js1606 LOC (9%) 99 files
*.cs230 LOC (1%) 7 files
*.graphql228 LOC (1%) 10 files
*.html24 LOC (<1%) 4 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 paths like ".*[.][Tt]est[.].*".
    • files with paths like ".*[.]test[.].*".
    • files with paths like ".*[-]tests/.*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*/[Tt]ests/.*".
    • files with paths like ".*/mock[-].*".
    • files with any line of content like ".*/simpletest/.*".
  • 37 files match defined criteria (297 lines of code, 1.7% vs. main code):
    • 20 *.ts files (204 lines of code)
    • 16 *.py files (83 lines of code)
    • 1 *.js files (10 lines of code)
  • " *.ts" is biggest, containing 68.69% of code.
  • " *.js" is smallest, containing 3.37% of code.


*.ts204 LOC (68%) 20 files
*.py83 LOC (27%) 16 files
*.js10 LOC (3%) 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 ".*/package[-]lock[.]json".
  • 1 file matches defined criteria (13 lines of code, 0.1% vs. main code). All matches are in *.json files.


*.json13 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 ".*/package[.]json".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]bat".
    • files with paths like ".*[.]csproj".
    • files with paths like ".*/package[-]lock[.]json".
  • 18 files match defined criteria (207 lines of code, 1.2% vs. main code):
    • 15 *.bat files (166 lines of code)
    • 3 *.csproj files (41 lines of code)
  • " *.bat" is biggest, containing 80.19% of code.
  • " *.csproj" is smallest, containing 19.81% of code.


*.bat166 LOC (80%) 15 files
*.csproj41 LOC (19%) 3 files
Other Code
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 ".*/[.]npmignore".
    • files with paths like ".*[.]json".
    • files with paths like ".*/[.]eslintignore".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]txt".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 439 files match defined criteria (18,445 lines of code, 106.6% vs. main code):
    • 180 *.md files (11,247 lines of code)
    • 258 *.json files (7,197 lines of code)
    • 1 *.sql files (1 lines of code)
  • " *.md" is biggest, containing 60.98% of code.
  • " *.sql" is smallest, containing 0.01% of code.


*.md11247 LOC (60%) 180 files
*.json7197 LOC (39%) 258 files
*.sql1 LOC (<1%) 1 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
  • *.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
  • *.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
  • *.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
  • *.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)
  • *.graphql 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
  • *.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


2022-01-31 16:56