microsoft / PowerToys
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
xaml
csproj
vcxproj
filters
resx
props
txt
wxs
cmd
gcode
wixproj
targets
reg
editorconfig
clang-format
gitmodules
gitattributes
fx
  • 31 extensions are included in analyses: cs, h, cpp, xaml, json, js, md, csproj, vcxproj, filters, resx, svg, ps1, yml, props, txt, xml, wxs, cmd, gcode, html, wixproj, targets, css, reg, editorconfig, clang-format, gitmodules, gitattributes, fx, gitignore
  • 7 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (30 files).
    • exclude files with path like ".*/deps/.*" (Dependencies) (3 files).
    • exclude files with path like ".*[.]resx" (The resx resource files) (39 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) (4 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.

main176351 LOC (85%) 1551 files
test13821 LOC (6%) 94 files
generated5245 LOC (2%) 29 files
build and deployment4548 LOC (2%) 53 files
other7111 LOC (3%) 190 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
gcode
xaml
vcxproj
filters
wxs
wixproj
props
fx
reg
cmd
targets
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 1551 files match defined criteria (176,351 lines of code, 100.0% vs. main code):
    • 2 *.gcode files (55,180 lines of code)
    • 722 *.cs files (49,018 lines of code)
    • 250 *.cpp files (43,198 lines of code)
    • 113 *.xaml files (9,388 lines of code)
    • 324 *.h files (9,353 lines of code)
    • 56 *.vcxproj files (6,203 lines of code)
    • 44 *.filters files (2,829 lines of code)
    • 17 *.ps1 files (472 lines of code)
    • 4 *.wxs files (183 lines of code)
    • 2 *.wixproj files (167 lines of code)
    • 7 *.props files (126 lines of code)
    • 2 *.html files (98 lines of code)
    • 1 *.fx files (67 lines of code)
    • 1 *.reg files (42 lines of code)
    • 3 *.cmd files (18 lines of code)
    • 2 *.targets files (8 lines of code)
    • 1 *.js files (1 lines of code)
  • " *.gcode" is biggest, containing 31.29% of code.
  • " *.js" is smallest, containing 0% of code.


*.gcode55180 LOC (31%) 2 files
*.cs49018 LOC (27%) 722 files
*.cpp43198 LOC (24%) 250 files
*.xaml9388 LOC (5%) 113 files
*.h9353 LOC (5%) 324 files
*.vcxproj6203 LOC (3%) 56 files
*.filters2829 LOC (1%) 44 files
*.ps1472 LOC (<1%) 17 files
*.wxs183 LOC (<1%) 4 files
*.wixproj167 LOC (<1%) 2 files
*.props126 LOC (<1%) 7 files
*.html98 LOC (<1%) 2 files
*.fx67 LOC (<1%) 1 files
*.reg42 LOC (<1%) 1 files
*.cmd18 LOC (<1%) 3 files
*.targets8 LOC (<1%) 2 files
*.js1 LOC (<1%) 1 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
csproj
vcxproj
filters
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*/[Ss]pecs/.*".
    • files with paths like ".*[.][Tt]ests[.].*".
    • files with paths like ".*[-]tests/.*".
    • files with paths like ".*/UnitTests?/.*".
    • files with paths like ".*/[Tt]ests/.*".
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*[.][Tt]est/.*".
    • files with paths like ".*[.][Tt]est[.].*".
    • files with paths like ".*/Mocks/.*".
    • files with any line of content like ".*/simpletest/.*".
    • files with paths like ".*UnitTests/.*".
  • 94 files match defined criteria (13,821 lines of code, 7.8% vs. main code):
    • 64 *.cs files (8,059 lines of code)
    • 15 *.cpp files (4,926 lines of code)
    • 10 *.csproj files (518 lines of code)
    • 3 *.h files (140 lines of code)
    • 1 *.vcxproj files (96 lines of code)
    • 1 *.filters files (82 lines of code)
  • " *.cs" is biggest, containing 58.31% of code.
  • " *.filters" is smallest, containing 0.59% of code.


*.cs8059 LOC (58%) 64 files
*.cpp4926 LOC (35%) 15 files
*.csproj518 LOC (3%) 10 files
*.h140 LOC (1%) 3 files
*.vcxproj96 LOC (<1%) 1 files
*.filters82 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 "[/][/][ ]*".
  • 29 files match defined criteria (5,245 lines of code, 3.0% vs. main code). All matches are in *.cs files.


*.cs5245 LOC (100%) 29 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 ".*/[.]gitattributes".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/[.]gitmodules".
    • files with paths like ".*[.]csproj".
  • 53 files match defined criteria (4,548 lines of code, 2.6% vs. main code). All matches are in *.csproj files.


*.csproj4548 LOC (100%) 53 files
Other Code
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]json".
    • files with paths like ".*[.]md".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]svg".
    • files with paths like ".*[.]editorconfig".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 190 files match defined criteria (7,111 lines of code, 4.0% vs. main code):
    • 95 *.json files (3,947 lines of code)
    • 78 *.md files (2,605 lines of code)
    • 6 *.xml files (344 lines of code)
    • 11 *.svg files (215 lines of code)
  • " *.json" is biggest, containing 55.51% of code.
  • " *.svg" is smallest, containing 3.02% of code.


*.json3947 LOC (55%) 95 files
*.md2605 LOC (36%) 78 files
*.xml344 LOC (4%) 6 files
*.svg215 LOC (3%) 11 files
Analyzers
Info about analyzers used for source code examinations.
  • *.gcode 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
  • *.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)
  • *.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
  • *.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
  • *.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
  • *.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
  • *.wxs 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
  • *.wixproj 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
  • *.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
  • *.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
  • *.fx 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
  • *.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
  • *.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
  • *.targets 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-31 01:12