aws-samples / aws-serverless-workshops
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
eslintignore
  • 20 extensions are included in analyses: md, scss, html, js, ts, css, json, yaml, toml, svg, yml, gitignore, py, txt, sh, editorconfig, go, xml, ipynb, eslintignore
  • 11 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (8 files).
    • exclude files with path like ".*/bootstrap[.](js|css|less|scss|styl)" (Bootstrap) (1 file).
    • exclude files with path like ".*\.d\.ts" (Typescript definition files) (2 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 "(?i).*/jquery.*[.]js" (jQuery files) (1 file).
    • exclude files with path like ".*jquery[.].*[.]js" (jQuery library) (0 files).
    • exclude files with path like ".*/bootstrap[-].*" (Library) (2 files).
    • exclude files with path like ".*[.]txt" (Text files) (1 file).
    • exclude files with path like ".*/sokrates_conventions[.]json" (Sokrates scoping conventions) (1 file).
    • exclude files with path like ".*/static/js/.*" (JS library) (4 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.

main34406 LOC (14%) 223 files
test231 LOC (<1%) 12 files
generated0 LOC (0%) 0 files
build and deployment37 LOC (<1%) 2 files
other211070 LOC (85%) 146 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 ".*".
  • 223 files match defined criteria (34,406 lines of code, 100.0% vs. main code):
    • 13 *.js files (18,585 lines of code)
    • 82 *.scss files (4,487 lines of code)
    • 24 *.css files (4,254 lines of code)
    • 14 *.yaml files (4,151 lines of code)
    • 42 *.html files (965 lines of code)
    • 6 *.yml files (767 lines of code)
    • 24 *.ts files (646 lines of code)
    • 13 *.toml files (297 lines of code)
    • 4 *.py files (163 lines of code)
    • 1 *.go files (91 lines of code)
  • " *.js" is biggest, containing 54.02% of code.
  • " *.go" is smallest, containing 0.26% of code.


*.js18585 LOC (54%) 13 files
*.scss4487 LOC (13%) 82 files
*.css4254 LOC (12%) 24 files
*.yaml4151 LOC (12%) 14 files
*.html965 LOC (2%) 42 files
*.yml767 LOC (2%) 6 files
*.ts646 LOC (1%) 24 files
*.toml297 LOC (<1%) 13 files
*.py163 LOC (<1%) 4 files
*.go91 LOC (<1%) 1 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 any line of content like ".*/simpletest/.*".
    • files with paths like ".*/mock[-].*".
  • 12 files match defined criteria (231 lines of code, 0.7% vs. main code):
    • 9 *.ts files (167 lines of code)
    • 3 *.js files (64 lines of code)
  • " *.ts" is biggest, containing 72.29% of code.
  • " *.js" is smallest, containing 27.71% of code.


*.ts167 LOC (72%) 9 files
*.js64 LOC (27%) 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 ".*/package[.]json".
    • files with paths like ".*[.]sh".
  • 2 files match defined criteria (37 lines of code, 0.1% vs. main code). All matches are in *.sh files.


*.sh37 LOC (100%) 2 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 ".*[.]json".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]editorconfig".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[.]eslintignore".
    • files with paths like ".*[.]svg".
    • files with paths like ".*/LICENSE[.][a-z0-9]+".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 146 files match defined criteria (211,070 lines of code, 613.5% vs. main code):
    • 20 *.json files (200,780 lines of code)
    • 118 *.md files (6,439 lines of code)
    • 7 *.svg files (3,293 lines of code)
    • 1 *.ipynb files (558 lines of code)
  • " *.json" is biggest, containing 95.12% of code.
  • " *.ipynb" is smallest, containing 0.26% of code.


*.json200780 LOC (95%) 20 files
*.md6439 LOC (3%) 118 files
*.svg3293 LOC (1%) 7 files
*.ipynb558 LOC (<1%) 1 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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
  • *.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
  • *.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
  • *.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
  • *.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
  • *.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
  • *.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
  • *.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
  • *.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
  • *.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


2022-01-31 15:40