microsoft / PSRule
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
jsonc
resx
csproj
txt
xsd
editorconfig
  • 19 extensions are included in analyses: cs, md, ps1, yaml, json, yml, psd1, jsonc, resx, csproj, txt, psm1, html, css, ps1xml, gitignore, xsd, py, editorconfig
  • 7 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (29 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (91 files).
    • exclude files with path like ".*[.]resx" (The resx resource files) (7 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) (2 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.

main26791 LOC (55%) 219 files
test16671 LOC (34%) 129 files
generated1447 LOC (2%) 7 files
build and deployment223 LOC (<1%) 4 files
other3162 LOC (6%) 30 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 ".*".
  • 219 files match defined criteria (26,791 lines of code, 100.0% vs. main code):
    • 202 *.cs files (22,858 lines of code)
    • 2 *.psm1 files (2,243 lines of code)
    • 1 *.ps1xml files (592 lines of code)
    • 5 *.ps1 files (467 lines of code)
    • 2 *.html files (334 lines of code)
    • 4 *.psd1 files (138 lines of code)
    • 1 *.yml files (115 lines of code)
    • 2 *.yaml files (44 lines of code)
  • " *.cs" is biggest, containing 85.32% of code.
  • " *.yaml" is smallest, containing 0.16% of code.


*.cs22858 LOC (85%) 202 files
*.psm12243 LOC (8%) 2 files
*.ps1xml592 LOC (2%) 1 files
*.ps1467 LOC (1%) 5 files
*.html334 LOC (1%) 2 files
*.psd1138 LOC (<1%) 4 files
*.yml115 LOC (<1%) 1 files
*.yaml44 LOC (<1%) 2 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
jsonc
csproj
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 ".*[.][Tt]ests/.*".
    • files with paths like ".*[.][Tt]ests[.].*".
    • files with any line of content like ".*/simpletest/.*".
  • 129 files match defined criteria (16,671 lines of code, 62.2% vs. main code):
    • 44 *.ps1 files (7,906 lines of code)
    • 30 *.cs files (4,730 lines of code)
    • 11 *.jsonc files (1,847 lines of code)
    • 18 *.yaml files (1,230 lines of code)
    • 11 *.psd1 files (686 lines of code)
    • 14 *.yml files (161 lines of code)
    • 1 *.csproj files (111 lines of code)
  • " *.ps1" is biggest, containing 47.42% of code.
  • " *.csproj" is smallest, containing 0.67% of code.


*.ps17906 LOC (47%) 44 files
*.cs4730 LOC (28%) 30 files
*.jsonc1847 LOC (11%) 11 files
*.yaml1230 LOC (7%) 18 files
*.psd1686 LOC (4%) 11 files
*.yml161 LOC (<1%) 14 files
*.csproj111 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 "[/][/][ ]*".
  • 7 files match defined criteria (1,447 lines of code, 5.4% vs. main code). All matches are in *.cs files.


*.cs1447 LOC (100%) 7 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 ".*[.]csproj".
  • 4 files match defined criteria (223 lines of code, 0.8% vs. main code). All matches are in *.csproj files.


*.csproj223 LOC (100%) 4 files
Other Code
xsd
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]json".
    • files with paths like ".*[.]editorconfig".
    • files with paths like ".*[.]md".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]txt".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 30 files match defined criteria (3,162 lines of code, 11.8% vs. main code):
    • 11 *.json files (2,432 lines of code)
    • 18 *.md files (622 lines of code)
    • 1 *.xsd files (108 lines of code)
  • " *.json" is biggest, containing 76.91% of code.
  • " *.xsd" is smallest, containing 3.42% of code.


*.json2432 LOC (76%) 11 files
*.md622 LOC (19%) 18 files
*.xsd108 LOC (3%) 1 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)
  • *.psm1 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
  • *.ps1xml 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
  • *.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
  • *.psd1 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
  • *.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
  • *.yaml 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


2022-01-30 16:04