microsoft / CameraTraps
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
ini
resx
p
xaml
csproj
gitmodules
  • 20 extensions are included in analyses: py, ipynb, sh, md, cs, txt, yml, json, js, html, gitignore, css, ini, resx, p, yaml, xaml, csproj, bat, gitmodules
  • 8 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (9 files).
    • exclude files with path like ".*[.]resx" (The resx resource files) (3 files).
    • exclude files with path like ".*/bootstrap[.](js|css|less|scss|styl)" (Bootstrap) (1 file).
    • 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 ".*/sokrates_conventions[.]json" (Sokrates scoping conventions) (1 file).
    • exclude files with path like ".*[.]txt" (Text files) (18 files).
    • exclude files with path like ".*/static/js/.*" (JS library) (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.

main52223 LOC (48%) 412 files
test5870 LOC (5%) 33 files
generated278 LOC (<1%) 5 files
build and deployment1464 LOC (1%) 42 files
other47773 LOC (44%) 131 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
p
xaml
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 412 files match defined criteria (52,223 lines of code, 100.0% vs. main code):
    • 372 *.py files (47,684 lines of code)
    • 19 *.cs files (2,622 lines of code)
    • 2 *.html files (938 lines of code)
    • 3 *.p files (579 lines of code)
    • 12 *.yml files (250 lines of code)
    • 2 *.xaml files (92 lines of code)
    • 2 *.js files (58 lines of code)
  • " *.py" is biggest, containing 91.31% of code.
  • " *.js" is smallest, containing 0.11% of code.


*.py47684 LOC (91%) 372 files
*.cs2622 LOC (5%) 19 files
*.html938 LOC (1%) 2 files
*.p579 LOC (1%) 3 files
*.yml250 LOC (<1%) 12 files
*.xaml92 LOC (<1%) 2 files
*.js58 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 ".*/[Tt]ests/.*".
    • files with paths like ".*_test[.].*".
    • files with any line of content like ".*/simpletest/.*".
  • 33 files match defined criteria (5,870 lines of code, 11.2% vs. main code). All matches are in *.py files.


*.py5870 LOC (100%) 33 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 ".*[.]cs" AND any line of content like "[/][/][ ]*".
    • files with paths like ".*/package[-]lock[.]json".
  • 5 files match defined criteria (278 lines of code, 0.5% vs. main code):
    • 1 *.json files (174 lines of code)
    • 4 *.cs files (104 lines of code)
  • " *.json" is biggest, containing 62.59% of code.
  • " *.cs" is smallest, containing 37.41% of code.


*.json174 LOC (62%) 1 files
*.cs104 LOC (37%) 4 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 ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/[.]gitmodules".
    • files with paths like ".*[.]sh".
    • files with paths like ".*[.]csproj".
    • files with paths like ".*/package[-]lock[.]json".
    • files with paths like ".*/package[.]json".
    • files with paths like ".*[.]bat".
  • 42 files match defined criteria (1,464 lines of code, 2.8% vs. main code):
    • 39 *.sh files (1,175 lines of code)
    • 2 *.csproj files (287 lines of code)
    • 1 *.bat files (2 lines of code)
  • " *.sh" is biggest, containing 80.26% of code.
  • " *.bat" is smallest, containing 0.14% of code.


*.sh1175 LOC (80%) 39 files
*.csproj287 LOC (19%) 2 files
*.bat2 LOC (<1%) 1 files
Other Code
ini
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]json".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]ini".
    • files with paths like ".*[.]md".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[Dd]emos?/.*".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 131 files match defined criteria (47,773 lines of code, 91.5% vs. main code):
    • 68 *.ipynb files (40,837 lines of code)
    • 36 *.md files (3,364 lines of code)
    • 9 *.json files (1,728 lines of code)
    • 1 *.css files (877 lines of code)
    • 8 *.py files (514 lines of code)
    • 8 *.html files (444 lines of code)
    • 1 *.ini files (9 lines of code)
  • " *.ipynb" is biggest, containing 85.48% of code.
  • " *.ini" is smallest, containing 0.02% of code.


*.ipynb40837 LOC (85%) 68 files
*.md3364 LOC (7%) 36 files
*.json1728 LOC (3%) 9 files
*.css877 LOC (1%) 1 files
*.py514 LOC (1%) 8 files
*.html444 LOC (<1%) 8 files
*.ini9 LOC (<1%) 1 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
  • *.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)
  • *.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
  • *.p files are analyzed with ObjectPascalAnalyzer:
    • 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
  • *.xaml 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
  • *.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-30 22:19