microsoft / Windows-driver-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
vcxproj
Filters
ini
cxx
hxx
filters
cmd
VcxProj
ctl
txt
props
xaml
man
mk
ps
csproj
resx
reg
gitmodules
gitattributes
  • 38 extensions are included in analyses: h, cpp, c, vcxproj, Filters, md, ini, cxx, hxx, filters, cmd, cs, VcxProj, xml, ctl, txt, H, js, props, xaml, man, htm, inc, hpp, mk, C, gitignore, CPP, ps, ps1, csproj, resx, bat, reg, gitmodules, gitattributes, json, svg
  • 6 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 ".*[.]resx" (The resx resource files) (2 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) (9 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.

main1011243 LOC (96%) 3624 files
test12057 LOC (1%) 59 files
generated116 LOC (<1%) 5 files
build and deployment551 LOC (<1%) 6 files
other22625 LOC (2%) 251 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
vcxproj
filters
cxx
man
hxx
xaml
cmd
props
reg
ctl
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 3624 files match defined criteria (1,011,243 lines of code, 100.0% vs. main code):
    • 610 *.c files (431,405 lines of code)
    • 793 *.cpp files (265,707 lines of code)
    • 1,495 *.h files (185,158 lines of code)
    • 312 *.vcxproj files (87,294 lines of code)
    • 307 *.filters files (19,095 lines of code)
    • 16 *.cxx files (5,036 lines of code)
    • 3 *.hpp files (4,788 lines of code)
    • 6 *.htm files (4,089 lines of code)
    • 11 *.cs files (2,525 lines of code)
    • 9 *.js files (1,747 lines of code)
    • 6 *.man files (1,634 lines of code)
    • 16 *.hxx files (1,182 lines of code)
    • 7 *.xaml files (774 lines of code)
    • 9 *.cmd files (558 lines of code)
    • 7 *.props files (194 lines of code)
    • 4 *.inc files (27 lines of code)
    • 1 *.reg files (18 lines of code)
    • 12 *.ctl files (12 lines of code)
  • " *.c" is biggest, containing 42.66% of code.
  • " *.ctl" is smallest, containing 0% of code.


*.c431405 LOC (42%) 610 files
*.cpp265707 LOC (26%) 793 files
*.h185158 LOC (18%) 1495 files
*.vcxproj87294 LOC (8%) 312 files
*.filters19095 LOC (1%) 307 files
*.cxx5036 LOC (<1%) 16 files
*.hpp4788 LOC (<1%) 3 files
*.htm4089 LOC (<1%) 6 files
*.cs2525 LOC (<1%) 11 files
*.js1747 LOC (<1%) 9 files
*.man1634 LOC (<1%) 6 files
*.hxx1182 LOC (<1%) 16 files
*.xaml774 LOC (<1%) 7 files
*.cmd558 LOC (<1%) 9 files
*.props194 LOC (<1%) 7 files
*.inc27 LOC (<1%) 4 files
*.reg18 LOC (<1%) 1 files
*.ctl12 LOC (<1%) 12 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
vcxproj
filters
cmd
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*/[Tt]ests/.*".
    • files with any line of content like ".*/simpletest/.*".
  • 59 files match defined criteria (12,057 lines of code, 1.2% vs. main code):
    • 22 *.cpp files (6,880 lines of code)
    • 3 *.c files (2,091 lines of code)
    • 24 *.h files (1,998 lines of code)
    • 4 *.vcxproj files (901 lines of code)
    • 4 *.filters files (96 lines of code)
    • 1 *.hpp files (90 lines of code)
    • 1 *.cmd files (1 lines of code)
  • " *.cpp" is biggest, containing 57.06% of code.
  • " *.cmd" is smallest, containing 0.01% of code.


*.cpp6880 LOC (57%) 22 files
*.c2091 LOC (17%) 3 files
*.h1998 LOC (16%) 24 files
*.vcxproj901 LOC (7%) 4 files
*.filters96 LOC (<1%) 4 files
*.hpp90 LOC (<1%) 1 files
*.cmd1 LOC (<1%) 1 files
Generated Code
Automatically generated files, not manually changed after generation.
ps
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.](ps|eps|pfa)".
    • files with paths like ".*[.]cs" AND any line of content like "[/][/][ ]*".
  • 5 files match defined criteria (116 lines of code, 0.0% vs. main code):
    • 3 *.cs files (89 lines of code)
    • 2 *.ps files (27 lines of code)
  • " *.cs" is biggest, containing 76.72% of code.
  • " *.ps" is smallest, containing 23.28% of code.


*.cs89 LOC (76%) 3 files
*.ps27 LOC (23%) 2 files
Build and Deployment Code
Source code used to configure or support build and deployment process.
csproj
mk
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 ".*/[.]gitmodules".
    • files with paths like ".*[.]bat".
    • files with paths like ".*[.]mk".
    • files with paths like ".*[.]csproj".
  • 6 files match defined criteria (551 lines of code, 0.1% vs. main code):
    • 2 *.csproj files (370 lines of code)
    • 3 *.mk files (179 lines of code)
    • 1 *.bat files (2 lines of code)
  • " *.csproj" is biggest, containing 67.15% of code.
  • " *.bat" is smallest, containing 0.36% of code.


*.csproj370 LOC (67%) 2 files
*.mk179 LOC (32%) 3 files
*.bat2 LOC (<1%) 1 files
Other Code
vcxproj
filters
ini
cmd
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 ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]txt".
    • files with paths like ".*[.]ini".
    • files with paths like ".*/[Ss]amples/.*".
    • files with paths like ".*[.]svg".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 251 files match defined criteria (22,625 lines of code, 2.2% vs. main code):
    • 15 *.c files (11,311 lines of code)
    • 150 *.md files (5,982 lines of code)
    • 12 *.vcxproj files (2,259 lines of code)
    • 20 *.h files (1,842 lines of code)
    • 12 *.filters files (448 lines of code)
    • 12 *.xml files (340 lines of code)
    • 1 *.svg files (239 lines of code)
    • 23 *.ini files (142 lines of code)
    • 2 *.ps1 files (53 lines of code)
    • 4 *.cmd files (9 lines of code)
  • " *.c" is biggest, containing 49.99% of code.
  • " *.cmd" is smallest, containing 0.04% of code.


*.c11311 LOC (49%) 15 files
*.md5982 LOC (26%) 150 files
*.vcxproj2259 LOC (9%) 12 files
*.h1842 LOC (8%) 20 files
*.filters448 LOC (1%) 12 files
*.xml340 LOC (1%) 12 files
*.svg239 LOC (1%) 1 files
*.ini142 LOC (<1%) 23 files
*.ps153 LOC (<1%) 2 files
*.cmd9 LOC (<1%) 4 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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
  • *.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
  • *.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
  • *.cxx 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
  • *.htm 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
  • *.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)
  • *.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
  • *.man 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
  • *.hxx 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
  • *.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
  • *.cmd 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
  • *.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
  • *.inc files are analyzed with PhpAnalyzer:
    • 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
  • *.reg 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
  • *.ctl files are analyzed with VisualBasicAnalyzer:
    • 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 09:38