aws-samples / aws-bootstrap-kit-examples
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
npmignore
plist
txt
properties
gitattributes
watchmanconfig
pro
storyboard
  • 28 extensions are included in analyses: ts, json, js, md, tsx, gitignore, npmignore, php, plist, xml, html, css, java, sh, yml, m, gradle, txt, svg, properties, gitattributes, watchmanconfig, sql, bat, bzl, h, pro, storyboard
  • 9 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (24 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 ".*/bin/.*" (Binaries for distribution) (8 files).
    • exclude files with path like ".*\.d\.ts" (Typescript definition files) (3 files).
    • exclude files with path like ".*/gradle/wrapper/.*" (Gradle) (1 file).
    • exclude files with path like ".*/proguard[-]rules[.]pro" (ProGuard) (1 file).
    • exclude files with path like ".*[.]txt" (Text files) (2 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.

main4799 LOC (1%) 98 files
test175 LOC (<1%) 10 files
generated132050 LOC (48%) 12 files
build and deployment332 LOC (<1%) 8 files
other135771 LOC (49%) 77 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 ".*".
  • 98 files match defined criteria (4,799 lines of code, 100.0% vs. main code):
    • 40 *.ts files (2,280 lines of code)
    • 1 *.yml files (761 lines of code)
    • 24 *.js files (580 lines of code)
    • 12 *.tsx files (554 lines of code)
    • 6 *.php files (247 lines of code)
    • 3 *.java files (128 lines of code)
    • 3 *.m files (106 lines of code)
    • 3 *.css files (61 lines of code)
    • 4 *.html files (60 lines of code)
    • 1 *.bzl files (17 lines of code)
    • 1 *.h files (5 lines of code)
  • " *.ts" is biggest, containing 47.51% of code.
  • " *.h" is smallest, containing 0.1% of code.


*.ts2280 LOC (47%) 40 files
*.yml761 LOC (15%) 1 files
*.js580 LOC (12%) 24 files
*.tsx554 LOC (11%) 12 files
*.php247 LOC (5%) 6 files
*.java128 LOC (2%) 3 files
*.m106 LOC (2%) 3 files
*.css61 LOC (1%) 3 files
*.html60 LOC (1%) 4 files
*.bzl17 LOC (<1%) 1 files
*.h5 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 ".*/[Tt]est/.*".
    • files with paths like ".*[.][Tt]est[.].*".
    • files with paths like ".*[.]test[.].*".
    • files with paths like ".*__tests__.*".
    • files with any line of content like ".*/simpletest/.*".
  • 10 files match defined criteria (175 lines of code, 3.6% vs. main code):
    • 8 *.ts files (164 lines of code)
    • 2 *.js files (11 lines of code)
  • " *.ts" is biggest, containing 93.71% of code.
  • " *.js" is smallest, containing 6.29% of code.


*.ts164 LOC (93%) 8 files
*.js11 LOC (6%) 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".
  • 12 files match defined criteria (132,050 lines of code, 2751.6% vs. main code). All matches are in *.json files.


*.json132050 LOC (100%) 12 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 ".*/package[-]lock[.]json".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/docker[-]compose[.]yml".
    • files with paths like ".*[.]sh".
    • files with paths like ".*/[.]gitattributes".
    • files with paths like ".*[.]bat".
    • files with paths like ".*/AndroidManifest[.]xml".
    • files with paths like ".*[.]gradle".
  • 8 files match defined criteria (332 lines of code, 6.9% vs. main code):
    • 3 *.gradle files (123 lines of code)
    • 3 *.sh files (100 lines of code)
    • 1 *.bat files (78 lines of code)
    • 1 *.yml files (31 lines of code)
  • " *.gradle" is biggest, containing 37.05% of code.
  • " *.yml" is smallest, containing 9.34% of code.


*.gradle123 LOC (37%) 3 files
*.sh100 LOC (30%) 3 files
*.bat78 LOC (23%) 1 files
*.yml31 LOC (9%) 1 files
Other Code
plist
storyboard
properties
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 ".*[.]txt".
    • files with paths like ".*/[.]npmignore".
    • files with paths like ".*[.]json".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]properties".
    • files with paths like ".*[.]plist".
    • files with paths like ".*[.]storyboard".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 77 files match defined criteria (135,771 lines of code, 2829.2% vs. main code):
    • 50 *.json files (132,996 lines of code)
    • 15 *.md files (2,436 lines of code)
    • 5 *.plist files (187 lines of code)
    • 1 *.storyboard files (57 lines of code)
    • 4 *.xml files (38 lines of code)
    • 1 *.sql files (35 lines of code)
    • 1 *.properties files (22 lines of code)
  • " *.json" is biggest, containing 97.96% of code.
  • " *.properties" is smallest, containing 0.02% of code.


*.json132996 LOC (97%) 50 files
*.md2436 LOC (1%) 15 files
*.plist187 LOC (<1%) 5 files
*.storyboard57 LOC (<1%) 1 files
*.xml38 LOC (<1%) 4 files
*.sql35 LOC (<1%) 1 files
*.properties22 LOC (<1%) 1 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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
  • *.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
  • *.tsx 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
  • *.php files are analyzed with PhpAnalyzer:
    • 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
  • *.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)
  • *.m files are analyzed with CppAnalyzer:
    • 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
  • *.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
  • *.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
  • *.h files are analyzed with CppAnalyzer:
    • 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:40