azure / PSRule.Rules.Azure
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
csproj
resx
txt
editorconfig
props
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.

main36795 LOC (12%) 363 files
test23014 LOC (7%) 126 files
generated517 LOC (<1%) 4 files
build and deployment184 LOC (<1%) 4 files
other241614 LOC (79%) 552 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
props
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 363 files match defined criteria (36,795 LOC, 100.0% vs. main code):
    • 212 *.cs files (17,917 LOC)
    • 62 *.ps1 files (10,996 LOC)
    • 71 *.yaml files (5,926 LOC)
    • 3 *.psm1 files (948 LOC)
    • 8 *.html files (508 LOC)
    • 3 *.psd1 files (319 LOC)
    • 2 *.py files (117 LOC)
    • 1 *.props files (57 LOC)
    • 1 *.toml files (7 LOC)
  • " *.cs" is biggest, containing 48.69% of LOC.
  • " *.toml" is smallest, containing 0.02% of LOC.


*.cs17917 LOC (48%) 212 files
*.ps110996 LOC (29%) 62 files
*.yaml5926 LOC (16%) 71 files
*.psm1948 LOC (2%) 3 files
*.html508 LOC (1%) 8 files
*.psd1319 LOC (<1%) 3 files
*.py117 LOC (<1%) 2 files
*.props57 LOC (<1%) 1 file
*.toml7 LOC (<1%) 1 file
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 ".*/[Tt]ests/.*".
    • files with paths like ".*[.][Tt]ests[.].*".
    • files with paths like ".*[.][Tt]ests/.*".
    • files with paths like ".*[.]tests[.].*".
    • files with paths like ".*[.][Tt]est[.].*".
    • files with paths like ".*/test[.].*".
    • files with paths like ".*/[Ss]pecs/.*".
  • 126 files match defined criteria (23,014 LOC, 62.5% vs. main code):
    • 78 *.ps1 files (16,709 LOC)
    • 38 *.cs files (4,856 LOC)
    • 5 *.jsonc files (980 LOC)
    • 1 *.csproj files (332 LOC)
    • 3 *.yaml files (120 LOC)
    • 1 *.xml files (17 LOC)
  • " *.ps1" is biggest, containing 72.6% of LOC.
  • " *.xml" is smallest, containing 0.07% of LOC.


*.ps116709 LOC (72%) 78 files
*.cs4856 LOC (21%) 38 files
*.jsonc980 LOC (4%) 5 files
*.csproj332 LOC (1%) 1 file
*.yaml120 LOC (<1%) 3 files
*.xml17 LOC (<1%) 1 file
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 "[/][/][ ]*".
  • 4 files match defined criteria (517 LOC, 1.4% vs. main code). All matches are in *.cs files.


*.cs517 LOC (100%) 4 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 ".*[.]csproj".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
  • 4 files match defined criteria (184 LOC, 0.5% vs. main code). All matches are in *.csproj files.


*.csproj184 LOC (100%) 4 files
Other Code
txt
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]json".
    • files with paths like ".*[.]txt".
    • files with paths like ".*[.]md".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/[Ss]amples/.*".
    • files with paths like ".*/[Ee]xamples/.*".
    • files with paths like ".*[.]editorconfig".
  • 552 files match defined criteria (241,614 LOC, 656.6% vs. main code):
    • 528 *.json files (240,796 LOC)
    • 18 *.md files (690 LOC)
    • 2 *.txt files (53 LOC)
    • 2 *.ps1 files (43 LOC)
    • 2 *.yaml files (32 LOC)
  • " *.json" is biggest, containing 99.66% of LOC.
  • " *.yaml" is smallest, containing 0.01% of LOC.


*.json240796 LOC (99%) 528 files
*.md690 LOC (<1%) 18 files
*.txt53 LOC (<1%) 2 files
*.ps143 LOC (<1%) 2 files
*.yaml32 LOC (<1%) 2 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)
  • *.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
  • *.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
  • *.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
  • *.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
  • *.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
  • *.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
  • *.toml 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


2025-05-06 21:46