aws-samples / iot-reference-architectures
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
properties
txt
mod
csproj
  • 22 extensions are included in analyses: java, sh, md, py, json, properties, bat, yaml, kts, xml, txt, js, css, gitignore, gradle, mod, yml, html, svg, go, cs, csproj
  • 7 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/gradle/wrapper/.*" (Gradle) (9 files).
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (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 ".*[.]min[.]js" (Minimized JS library) (1 file).
    • exclude files with path like ".*[.]txt" (Text files) (5 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.

main6325 LOC (59%) 127 files
test602 LOC (5%) 13 files
generated0 LOC (0%) 0 files
build and deployment1136 LOC (10%) 58 files
other2538 LOC (23%) 55 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 ".*".
  • 127 files match defined criteria (6,325 lines of code, 100.0% vs. main code):
    • 82 *.java files (3,933 lines of code)
    • 21 *.py files (1,024 lines of code)
    • 7 *.kts files (566 lines of code)
    • 7 *.yaml files (413 lines of code)
    • 1 *.cs files (130 lines of code)
    • 4 *.js files (122 lines of code)
    • 3 *.css files (55 lines of code)
    • 1 *.html files (47 lines of code)
    • 1 *.go files (35 lines of code)
  • " *.java" is biggest, containing 62.18% of code.
  • " *.go" is smallest, containing 0.55% of code.


*.java3933 LOC (62%) 82 files
*.py1024 LOC (16%) 21 files
*.kts566 LOC (8%) 7 files
*.yaml413 LOC (6%) 7 files
*.cs130 LOC (2%) 1 files
*.js122 LOC (1%) 4 files
*.css55 LOC (<1%) 3 files
*.html47 LOC (<1%) 1 files
*.go35 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 ".*[-]test[-].*".
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*_test[.].*".
    • files with any line of content like ".*/simpletest/.*".
  • 13 files match defined criteria (602 lines of code, 9.5% vs. main code):
    • 7 *.java files (571 lines of code)
    • 1 *.py files (26 lines of code)
    • 5 *.sh files (5 lines of code)
  • " *.java" is biggest, containing 94.85% of code.
  • " *.sh" is smallest, containing 0.83% of code.


*.java571 LOC (94%) 7 files
*.py26 LOC (4%) 1 files
*.sh5 LOC (<1%) 5 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 ".*[.]sh".
    • files with paths like ".*[.]bat".
    • files with paths like ".*/package[.]json".
    • files with paths like ".*[.]csproj".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]gradle".
  • 58 files match defined criteria (1,136 lines of code, 18.0% vs. main code):
    • 9 *.bat files (628 lines of code)
    • 46 *.sh files (424 lines of code)
    • 2 *.gradle files (73 lines of code)
    • 1 *.csproj files (11 lines of code)
  • " *.bat" is biggest, containing 55.28% of code.
  • " *.csproj" is smallest, containing 0.97% of code.


*.bat628 LOC (55%) 9 files
*.sh424 LOC (37%) 46 files
*.gradle73 LOC (6%) 2 files
*.csproj11 LOC (<1%) 1 files
Other Code
properties
mod
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 ".*[.]properties".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/go[.]mod".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 55 files match defined criteria (2,538 lines of code, 40.1% vs. main code):
    • 28 *.md files (2,001 lines of code)
    • 14 *.json files (292 lines of code)
    • 6 *.xml files (209 lines of code)
    • 6 *.properties files (33 lines of code)
    • 1 *.mod files (3 lines of code)
  • " *.md" is biggest, containing 78.84% of code.
  • " *.mod" is smallest, containing 0.12% of code.


*.md2001 LOC (78%) 28 files
*.json292 LOC (11%) 14 files
*.xml209 LOC (8%) 6 files
*.properties33 LOC (1%) 6 files
*.mod3 LOC (<1%) 1 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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)
  • *.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
  • *.kts files are analyzed with KotlinAnalyzer:
    • 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 (based on imports and package statements)
  • *.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
  • *.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)
  • *.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
  • *.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
  • *.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:45