microsoft / CDM
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
csproj
nuspec
npmignore
gitattributes
resx
properties
prettierignore
  • 21 extensions are included in analyses: json, txt, py, cs, md, java, ts, csproj, xml, nuspec, gitignore, html, css, js, ps1, npmignore, gitattributes, resx, yml, properties, prettierignore
  • 8 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (8 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (25 files).
    • exclude files with path like ".*[.]resx" (The resx resource files) (1 file).
    • exclude files with path like ".*/[Vv]endors?/.*" (Dependencies) (107 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 ".*/sokrates_conventions[.]json" (Sokrates scoping conventions) (1 file).
    • exclude files with path like ".*[.]txt" (Text files) (545 files).
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.

main109638 LOC (<1%) 1431 files
test58452 LOC (<1%) 437 files
generated17834 LOC (<1%) 2 files
build and deployment362 LOC (<1%) 10 files
other22860547 LOC (99%) 49132 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 ".*".
  • 1431 files match defined criteria (109,638 lines of code, 100.0% vs. main code):
    • 405 *.cs files (32,326 lines of code)
    • 308 *.java files (30,314 lines of code)
    • 303 *.ts files (25,117 lines of code)
    • 414 *.py files (21,875 lines of code)
    • 1 *.ps1 files (6 lines of code)
  • " *.cs" is biggest, containing 29.48% of code.
  • " *.ps1" is smallest, containing 0.01% of code.


*.cs32326 LOC (29%) 405 files
*.java30314 LOC (27%) 308 files
*.ts25117 LOC (22%) 303 files
*.py21875 LOC (19%) 414 files
*.ps16 LOC (<1%) 1 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
csproj
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.][Tt]ests/.*".
    • files with paths like ".*[.][Tt]ests[.].*".
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*/[Tt]ests/.*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*_test[.].*".
    • files with paths like ".*/TestData/.*".
    • files with paths like ".*[.][Tt]est[.].*".
    • files with paths like ".*[.]test[.].*".
    • files with paths like ".*__test__.*".
    • files with any line of content like ".*/simpletest/.*".
  • 437 files match defined criteria (58,452 lines of code, 53.3% vs. main code):
    • 102 *.ts files (16,156 lines of code)
    • 104 *.cs files (15,460 lines of code)
    • 109 *.java files (15,410 lines of code)
    • 120 *.py files (11,293 lines of code)
    • 1 *.ps1 files (108 lines of code)
    • 1 *.csproj files (25 lines of code)
  • " *.ts" is biggest, containing 27.64% of code.
  • " *.csproj" is smallest, containing 0.04% of code.


*.ts16156 LOC (27%) 102 files
*.cs15460 LOC (26%) 104 files
*.java15410 LOC (26%) 109 files
*.py11293 LOC (19%) 120 files
*.ps1108 LOC (<1%) 1 files
*.csproj25 LOC (<1%) 1 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".
  • 2 files match defined criteria (17,834 lines of code, 16.3% vs. main code):
    • 1 *.json files (16,916 lines of code)
    • 1 *.cs files (918 lines of code)
  • " *.json" is biggest, containing 94.85% of code.
  • " *.cs" is smallest, containing 5.15% of code.


*.json16916 LOC (94%) 1 files
*.cs918 LOC (5%) 1 files
Build and Deployment Code
Source code used to configure or support build and deployment process.
nuspec
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 ".*[.]nuspec".
    • files with paths like ".*[.]csproj".
    • files with paths like ".*/pom[.]xml".
    • files with paths like ".*/[.]gitattributes".
    • files with paths like ".*/package[-]lock[.]json".
    • files with paths like ".*/package[.]json".
  • 10 files match defined criteria (362 lines of code, 0.3% vs. main code):
    • 6 *.nuspec files (217 lines of code)
    • 4 *.csproj files (145 lines of code)
  • " *.nuspec" is biggest, containing 59.94% of code.
  • " *.csproj" is smallest, containing 40.06% of code.


*.nuspec217 LOC (59%) 6 files
*.csproj145 LOC (40%) 4 files
Other Code
properties
csproj
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 ".*[.]md".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*/[Ee]xamples/.*".
    • files with paths like ".*/[Ss]amples/.*".
    • files with paths like ".*[.]properties".
    • files with paths like ".*/[.]npmignore".
    • files with paths like ".*/[.]prettierignore".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 49132 files match defined criteria (22,860,547 lines of code, 20850.9% vs. main code):
    • 48,576 *.json files (22,842,252 lines of code)
    • 492 *.md files (11,474 lines of code)
    • 17 *.java files (2,493 lines of code)
    • 16 *.cs files (2,395 lines of code)
    • 11 *.xml files (830 lines of code)
    • 7 *.py files (486 lines of code)
    • 4 *.ts files (352 lines of code)
    • 1 *.properties files (147 lines of code)
    • 8 *.csproj files (118 lines of code)
  • " *.json" is biggest, containing 99.92% of code.
  • " *.csproj" is smallest, containing 0% of code.


*.json22842252 LOC (99%) 48576 files
*.md11474 LOC (<1%) 492 files
*.java2493 LOC (<1%) 17 files
*.cs2395 LOC (<1%) 16 files
*.xml830 LOC (<1%) 11 files
*.py486 LOC (<1%) 7 files
*.ts352 LOC (<1%) 4 files
*.properties147 LOC (<1%) 1 files
*.csproj118 LOC (<1%) 8 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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)
  • *.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)
  • *.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
  • *.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
  • *.ps1 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-30 15:42