microsoft / DirectX-Graphics-Samples
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
hlsl
hlsli
vcxproj
filters
props
txt
mtl
obj
inl
gltf
gitattributes
  • 19 extensions are included in analyses: h, cpp, hlsl, hlsli, vcxproj, filters, md, props, txt, bat, mtl, obj, py, gitignore, json, hpp, inl, gltf, gitattributes
  • 5 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (5 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) (11 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.

main2187512 LOC (47%) 690 files
test4578 LOC (<1%) 27 files
generated0 LOC (0%) 0 files
build and deployment10 LOC (<1%) 2 files
other2448121 LOC (52%) 1553 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
obj
gltf
hlsl
hlsli
vcxproj
filters
mtl
inl
props
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 690 files match defined criteria (2,187,512 lines of code, 100.0% vs. main code):
    • 3 *.obj files (2,024,901 lines of code)
    • 213 *.h files (55,556 lines of code)
    • 165 *.cpp files (40,492 lines of code)
    • 1 *.gltf files (30,667 lines of code)
    • 3 *.hpp files (15,981 lines of code)
    • 214 *.hlsl files (8,350 lines of code)
    • 47 *.hlsli files (4,833 lines of code)
    • 12 *.vcxproj files (2,620 lines of code)
    • 12 *.filters files (2,164 lines of code)
    • 3 *.mtl files (981 lines of code)
    • 2 *.inl files (471 lines of code)
    • 10 *.props files (316 lines of code)
    • 5 *.py files (180 lines of code)
  • " *.obj" is biggest, containing 92.57% of code.
  • " *.py" is smallest, containing 0.01% of code.


*.obj2024901 LOC (92%) 3 files
*.h55556 LOC (2%) 213 files
*.cpp40492 LOC (1%) 165 files
*.gltf30667 LOC (1%) 1 files
*.hpp15981 LOC (<1%) 3 files
*.hlsl8350 LOC (<1%) 214 files
*.hlsli4833 LOC (<1%) 47 files
*.vcxproj2620 LOC (<1%) 12 files
*.filters2164 LOC (<1%) 12 files
*.mtl981 LOC (<1%) 3 files
*.inl471 LOC (<1%) 2 files
*.props316 LOC (<1%) 10 files
*.py180 LOC (<1%) 5 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
vcxproj
hlsl
filters
hlsli
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with any line of content like ".*/simpletest/.*".
    • files with paths like ".*UnitTests/.*".
  • 27 files match defined criteria (4,578 lines of code, 0.2% vs. main code):
    • 3 *.cpp files (3,491 lines of code)
    • 1 *.vcxproj files (398 lines of code)
    • 16 *.hlsl files (318 lines of code)
    • 1 *.filters files (295 lines of code)
    • 4 *.h files (43 lines of code)
    • 2 *.hlsli files (33 lines of code)
  • " *.cpp" is biggest, containing 76.26% of code.
  • " *.hlsli" is smallest, containing 0.72% of code.


*.cpp3491 LOC (76%) 3 files
*.vcxproj398 LOC (8%) 1 files
*.hlsl318 LOC (6%) 16 files
*.filters295 LOC (6%) 1 files
*.h43 LOC (<1%) 4 files
*.hlsli33 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 ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitattributes".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]bat".
  • 2 files match defined criteria (10 lines of code, 0.0% vs. main code). All matches are in *.bat files.


*.bat10 LOC (100%) 2 files
Other Code
obj
gltf
vcxproj
hlsl
filters
hlsli
mtl
props
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 ".*/[Ss]amples/.*".
    • files with paths like ".*/LICENSE[.][a-z0-9]+".
  • 1553 files match defined criteria (2,448,121 lines of code, 111.9% vs. main code):
    • 3 *.obj files (2,024,901 lines of code)
    • 621 *.h files (271,939 lines of code)
    • 491 *.cpp files (80,101 lines of code)
    • 1 *.gltf files (30,667 lines of code)
    • 68 *.vcxproj files (16,180 lines of code)
    • 176 *.hlsl files (10,429 lines of code)
    • 68 *.filters files (7,225 lines of code)
    • 48 *.hlsli files (3,533 lines of code)
    • 66 *.md files (1,864 lines of code)
    • 3 *.mtl files (981 lines of code)
    • 2 *.json files (120 lines of code)
    • 2 *.props files (91 lines of code)
    • 4 *.bat files (90 lines of code)
  • " *.obj" is biggest, containing 82.71% of code.
  • " *.bat" is smallest, containing 0% of code.


*.obj2024901 LOC (82%) 3 files
*.h271939 LOC (11%) 621 files
*.cpp80101 LOC (3%) 491 files
*.gltf30667 LOC (1%) 1 files
*.vcxproj16180 LOC (<1%) 68 files
*.hlsl10429 LOC (<1%) 176 files
*.filters7225 LOC (<1%) 68 files
*.hlsli3533 LOC (<1%) 48 files
*.md1864 LOC (<1%) 66 files
*.mtl981 LOC (<1%) 3 files
*.json120 LOC (<1%) 2 files
*.props91 LOC (<1%) 2 files
*.bat90 LOC (<1%) 4 files
Analyzers
Info about analyzers used for source code examinations.
  • *.obj 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
  • *.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
  • *.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
  • *.gltf 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
  • *.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
  • *.hlsl 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
  • *.hlsli 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
  • *.vcxproj 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
  • *.filters 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
  • *.mtl 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
  • *.inl 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
  • *.props 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


2022-01-30 10:17