aws / amazon-sagemaker-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
txt
cfg
ini
org
properties
jsonl
patch
jq
Rmd
  • 29 extensions are included in analyses: py, ipynb, md, sh, json, yaml, rst, txt, html, yml, R, gitignore, xml, cfg, Dockerfile, c, ini, org, properties, css, jsonl, patch, java, bat, jq, js, svg, Rmd, r
  • 6 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (16 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 ".*/[Jj]avadoc/.*" (Generated documentation) (13 files).
    • exclude files with path like ".*[.]txt" (Text files) (42 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.

main188951 LOC (38%) 1501 files
test2298 LOC (<1%) 102 files
generated0 LOC (0%) 0 files
build and deployment3473 LOC (<1%) 101 files
other292140 LOC (60%) 675 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
org
jsonl
cfg
rmd
jq
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 1501 files match defined criteria (188,951 lines of code, 100.0% vs. main code):
    • 1,415 *.py files (177,189 lines of code)
    • 39 *.yaml files (5,054 lines of code)
    • 11 *.yml files (3,453 lines of code)
    • 2 *.org files (1,217 lines of code)
    • 1 *.jsonl files (1,000 lines of code)
    • 7 *.html files (380 lines of code)
    • 13 *.r files (350 lines of code)
    • 4 *.cfg files (155 lines of code)
    • 1 *.rmd files (67 lines of code)
    • 1 *.java files (51 lines of code)
    • 2 *.c files (16 lines of code)
    • 3 *.dockerfile files (10 lines of code)
    • 1 *.jq files (7 lines of code)
    • 1 *.js files (2 lines of code)
  • " *.py" is biggest, containing 93.78% of code.
  • " *.js" is smallest, containing 0% of code.


*.py177189 LOC (93%) 1415 files
*.yaml5054 LOC (2%) 39 files
*.yml3453 LOC (1%) 11 files
*.org1217 LOC (<1%) 2 files
*.jsonl1000 LOC (<1%) 1 files
*.html380 LOC (<1%) 7 files
*.r350 LOC (<1%) 13 files
*.cfg155 LOC (<1%) 4 files
*.rmd67 LOC (<1%) 1 files
*.java51 LOC (<1%) 1 files
*.c16 LOC (<1%) 2 files
*.dockerfile10 LOC (<1%) 3 files
*.jq7 LOC (<1%) 1 files
*.js2 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 ".*/test_.*".
    • files with paths like ".*/[Tt]ests/.*".
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*[-]test[-].*".
    • files with paths like ".*/[Ss]pecs/.*".
    • files with any line of content like ".*/simpletest/.*".
  • 102 files match defined criteria (2,298 lines of code, 1.2% vs. main code):
    • 93 *.py files (1,659 lines of code)
    • 7 *.yaml files (635 lines of code)
    • 2 *.sh files (4 lines of code)
  • " *.py" is biggest, containing 72.19% of code.
  • " *.sh" is smallest, containing 0.17% of code.


*.py1659 LOC (72%) 93 files
*.yaml635 LOC (27%) 7 files
*.sh4 LOC (<1%) 2 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 ".*[.]sh".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]bat".
    • files with paths like ".*/build[.]xml".
  • 101 files match defined criteria (3,473 lines of code, 1.8% vs. main code):
    • 100 *.sh files (3,446 lines of code)
    • 1 *.bat files (27 lines of code)
  • " *.sh" is biggest, containing 99.22% of code.
  • " *.bat" is smallest, containing 0.78% of code.


*.sh3446 LOC (99%) 100 files
*.bat27 LOC (<1%) 1 files
Other Code
patch
properties
ini
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 ".*[.](rst|rest|resttxt|rsttxt)".
    • files with paths like ".*/[Dd]emos?/.*".
    • files with paths like ".*[.]json".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]ini".
    • files with paths like ".*[.]properties".
    • files with paths like ".*[.]patch".
    • files with paths like ".*/[Ss]amples/.*".
    • files with paths like ".*/LICENSE[.][a-z0-9]+".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 675 files match defined criteria (292,140 lines of code, 154.6% vs. main code):
    • 414 *.ipynb files (286,028 lines of code)
    • 127 *.md files (2,143 lines of code)
    • 44 *.rst files (1,655 lines of code)
    • 76 *.json files (1,555 lines of code)
    • 1 *.patch files (293 lines of code)
    • 5 *.py files (292 lines of code)
    • 4 *.xml files (97 lines of code)
    • 2 *.properties files (46 lines of code)
    • 2 *.ini files (31 lines of code)
  • " *.ipynb" is biggest, containing 97.91% of code.
  • " *.ini" is smallest, containing 0.01% of code.


*.ipynb286028 LOC (97%) 414 files
*.md2143 LOC (<1%) 127 files
*.rst1655 LOC (<1%) 44 files
*.json1555 LOC (<1%) 76 files
*.patch293 LOC (<1%) 1 files
*.py292 LOC (<1%) 5 files
*.xml97 LOC (<1%) 4 files
*.properties46 LOC (<1%) 2 files
*.ini31 LOC (<1%) 2 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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
  • *.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
  • *.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
  • *.org 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
  • *.jsonl files are analyzed with JsonAnalyzer:
    • 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
  • *.r files are analyzed with RAnalyzer:
    • 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
  • *.cfg files are analyzed with CfgAnalyzer:
    • 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
  • *.rmd 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
  • *.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)
  • *.c files are analyzed with CStyleAnalyzer:
    • 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
  • *.dockerfile 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
  • *.jq 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
  • *.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 14:50