awslabs / aws-fpga-app-notes
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
prefs
ini
txt
properties
mk
launch
project
cl
pb
xmi
tcl
cproject
  • 23 extensions are included in analyses: cpp, h, md, prefs, xml, hpp, c, ini, txt, json, properties, mk, launch, project, sh, cl, pb, py, xmi, tcl, cproject, yaml, gitignore
  • 5 criteria are used to exclude files from analysis:
    • 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 ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (80 files).
    • exclude files with path like ".*[.]txt" (Text files) (10 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.

main21330 LOC (70%) 285 files
test563 LOC (1%) 5 files
generated0 LOC (0%) 0 files
build and deployment391 LOC (1%) 11 files
other8044 LOC (26%) 63 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
cl
launch
pb
tcl
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 285 files match defined criteria (21,330 lines of code, 100.0% vs. main code):
    • 148 *.cpp files (16,759 lines of code)
    • 95 *.h files (2,774 lines of code)
    • 20 *.hpp files (685 lines of code)
    • 9 *.c files (591 lines of code)
    • 1 *.yaml files (264 lines of code)
    • 3 *.cl files (138 lines of code)
    • 2 *.launch files (67 lines of code)
    • 2 *.py files (42 lines of code)
    • 3 *.pb files (6 lines of code)
    • 2 *.tcl files (4 lines of code)
  • " *.cpp" is biggest, containing 78.57% of code.
  • " *.tcl" is smallest, containing 0.02% of code.


*.cpp16759 LOC (78%) 148 files
*.h2774 LOC (13%) 95 files
*.hpp685 LOC (3%) 20 files
*.c591 LOC (2%) 9 files
*.yaml264 LOC (1%) 1 files
*.cl138 LOC (<1%) 3 files
*.launch67 LOC (<1%) 2 files
*.py42 LOC (<1%) 2 files
*.pb6 LOC (<1%) 3 files
*.tcl4 LOC (<1%) 2 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 any line of content like ".*/simpletest/.*".
  • 5 files match defined criteria (563 lines of code, 2.6% vs. main code):
    • 4 *.c files (554 lines of code)
    • 1 *.h files (9 lines of code)
  • " *.c" is biggest, containing 98.4% of code.
  • " *.h" is smallest, containing 1.6% of code.


*.c554 LOC (98%) 4 files
*.h9 LOC (1%) 1 files
Build and Deployment Code
Source code used to configure or support build and deployment process.
mk
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]mk".
    • files with paths like ".*[.]sh".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
  • 11 files match defined criteria (391 lines of code, 1.8% vs. main code):
    • 3 *.sh files (196 lines of code)
    • 8 *.mk files (195 lines of code)
  • " *.sh" is biggest, containing 50.13% of code.
  • " *.mk" is smallest, containing 49.87% of code.


*.sh196 LOC (50%) 3 files
*.mk195 LOC (49%) 8 files
Other Code
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 ".*[.]json".
    • files with paths like ".*[.]ini".
    • files with paths like ".*[.]properties".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 63 files match defined criteria (8,044 lines of code, 37.7% vs. main code):
    • 45 *.md files (6,310 lines of code)
    • 9 *.json files (1,703 lines of code)
    • 9 *.ini files (31 lines of code)
  • " *.md" is biggest, containing 78.44% of code.
  • " *.ini" is smallest, containing 0.39% of code.


*.md6310 LOC (78%) 45 files
*.json1703 LOC (21%) 9 files
*.ini31 LOC (<1%) 9 files
Analyzers
Info about analyzers used for source code examinations.
  • *.cpp 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
  • *.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
  • *.hpp 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
  • *.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
  • *.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
  • *.cl 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
  • *.launch files are analyzed with XmlAnalyzer:
    • 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
  • *.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
  • *.pb 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
  • *.tcl 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


2022-01-31 18:19