aws-samples / aws-serverless-saas-workshop
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
editorconfig
npmignore
  • 16 extensions are included in analyses: ts, html, json, scss, py, yaml, txt, js, md, gitignore, svg, editorconfig, sh, toml, npmignore, yml
  • 8 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[Vv]endors?/.*" (Dependencies) (40 files).
    • exclude files with path like ".*\.d\.ts" (Typescript definition files) (20 files).
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (81 files).
    • exclude files with path like ".*/bin/.*" (Binaries for distribution) (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) (69 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.

main98290 LOC (83%) 1750 files
test3190 LOC (2%) 144 files
generated0 LOC (0%) 0 files
build and deployment1242 LOC (1%) 23 files
other14396 LOC (12%) 280 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 ".*".
  • 1750 files match defined criteria (98,290 lines of code, 100.0% vs. main code):
    • 87 *.yaml files (33,845 lines of code)
    • 960 *.ts files (26,396 lines of code)
    • 182 *.py files (17,517 lines of code)
    • 326 *.html files (16,046 lines of code)
    • 166 *.scss files (4,132 lines of code)
    • 21 *.toml files (230 lines of code)
    • 4 *.yml files (96 lines of code)
    • 4 *.js files (28 lines of code)
  • " *.yaml" is biggest, containing 34.43% of code.
  • " *.js" is smallest, containing 0.03% of code.


*.yaml33845 LOC (34%) 87 files
*.ts26396 LOC (26%) 960 files
*.py17517 LOC (17%) 182 files
*.html16046 LOC (16%) 326 files
*.scss4132 LOC (4%) 166 files
*.toml230 LOC (<1%) 21 files
*.yml96 LOC (<1%) 4 files
*.js28 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 ".*[.]spec[.]ts".
    • files with paths like ".*/e2e/.*".
    • files with paths like ".*/protractor[.]conf[.]js".
    • files with paths like ".*/karma[.]conf[.]js".
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*[.][Tt]est[.].*".
    • files with paths like ".*[.]test[.].*".
    • files with any line of content like ".*/simpletest/.*".
  • 144 files match defined criteria (3,190 lines of code, 3.2% vs. main code):
    • 60 *.js files (1,850 lines of code)
    • 84 *.ts files (1,340 lines of code)
  • " *.js" is biggest, containing 57.99% of code.
  • " *.ts" is smallest, containing 42.01% of code.


*.js1850 LOC (57%) 60 files
*.ts1340 LOC (42%) 84 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 ".*/package[.]json".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]sh".
  • 23 files match defined criteria (1,242 lines of code, 1.3% vs. main code). All matches are in *.sh files.


*.sh1242 LOC (100%) 23 files
Other Code
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]md".
    • files with paths like ".*[.]json".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]editorconfig".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[.]npmignore".
  • 280 files match defined criteria (14,396 lines of code, 14.6% vs. main code):
    • 230 *.json files (13,828 lines of code)
    • 50 *.md files (568 lines of code)
  • " *.json" is biggest, containing 96.05% of code.
  • " *.md" is smallest, containing 3.95% of code.


*.json13828 LOC (96%) 230 files
*.md568 LOC (3%) 50 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
  • *.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
  • *.scss files are analyzed with ScssAnalyzer:
    • 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
  • *.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


2022-01-31 17:48