microsoft / pxt
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
txt
jsproj
gitattributes
jshintrc
eps
eslintignore
  • 20 extensions are included in analyses: ts, md, tsx, js, svg, json, py, less, html, css, sh, yml, gitignore, txt, jsproj, gitattributes, xml, jshintrc, eps, eslintignore
  • 9 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (35 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (269 files).
    • exclude files with path like ".*/docs?/_?(build|themes?|templates?|static)/.*" (Sphinx) (0 files).
    • exclude files with path like ".*\.d\.ts" (Typescript definition files) (21 files).
    • exclude files with path like ".*[.]min[.]js" (Minimized JS library) (1 file).
    • 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) (1 file).
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.

main150762 LOC (72%) 526 files
test10355 LOC (4%) 540 files
generated16444 LOC (7%) 1 files
build and deployment112 LOC (<1%) 10 files
other30038 LOC (14%) 272 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
jsproj
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 526 files match defined criteria (150,762 lines of code, 100.0% vs. main code):
    • 259 *.ts files (100,141 lines of code)
    • 126 *.tsx files (32,699 lines of code)
    • 65 *.less files (10,240 lines of code)
    • 43 *.html files (3,326 lines of code)
    • 14 *.js files (2,226 lines of code)
    • 17 *.css files (1,980 lines of code)
    • 2 *.jsproj files (150 lines of code)
  • " *.ts" is biggest, containing 66.42% of code.
  • " *.jsproj" is smallest, containing 0.1% of code.


*.ts100141 LOC (66%) 259 files
*.tsx32699 LOC (21%) 126 files
*.less10240 LOC (6%) 65 files
*.html3326 LOC (2%) 43 files
*.js2226 LOC (1%) 14 files
*.css1980 LOC (1%) 17 files
*.jsproj150 LOC (<1%) 2 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[-]tests/.*".
    • files with paths like ".*/karma[.]conf[.]js".
    • files with paths like ".*/[Tt]ests/.*".
    • files with paths like ".*[.]spec[.]ts".
    • files with any line of content like ".*/simpletest/.*".
  • 540 files match defined criteria (10,355 lines of code, 6.9% vs. main code):
    • 433 *.ts files (9,327 lines of code)
    • 93 *.py files (595 lines of code)
    • 8 *.js files (267 lines of code)
    • 1 *.html files (132 lines of code)
    • 5 *.sh files (34 lines of code)
  • " *.ts" is biggest, containing 90.07% of code.
  • " *.sh" is smallest, containing 0.33% of code.


*.ts9327 LOC (90%) 433 files
*.py595 LOC (5%) 93 files
*.js267 LOC (2%) 8 files
*.html132 LOC (1%) 1 files
*.sh34 LOC (<1%) 5 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 ".*[.](ps|eps|pfa)".
    • files with paths like ".*/package[-]lock[.]json".
  • 1 file matches defined criteria (16,444 lines of code, 10.9% vs. main code). All matches are in *.json files.


*.json16444 LOC (100%) 1 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 ".*[.]sh".
    • files with paths like ".*/package[.]json".
    • files with paths like ".*/package[-]lock[.]json".
    • files with paths like ".*([.]|/)webpack([.]|/).*".
  • 10 files match defined criteria (112 lines of code, 0.1% vs. main code):
    • 9 *.sh files (74 lines of code)
    • 1 *.js files (38 lines of code)
  • " *.sh" is biggest, containing 66.07% of code.
  • " *.js" is smallest, containing 33.93% of code.


*.sh74 LOC (66%) 9 files
*.js38 LOC (33%) 1 files
Other Code
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]json".
    • files with paths like ".*/[.]eslintignore".
    • 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 ".*[.]svg".
    • files with paths like ".*/[Ss]amples/.*".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 272 files match defined criteria (30,038 lines of code, 19.9% vs. main code):
    • 69 *.json files (23,687 lines of code)
    • 175 *.md files (6,039 lines of code)
    • 28 *.svg files (312 lines of code)
  • " *.json" is biggest, containing 78.86% of code.
  • " *.svg" is smallest, containing 1.04% of code.


*.json23687 LOC (78%) 69 files
*.md6039 LOC (20%) 175 files
*.svg312 LOC (1%) 28 files
Analyzers
Info about analyzers used for source code examinations.
  • *.ts files are analyzed with TypeScriptAnalyzer:
    • 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
  • *.tsx files are analyzed with TypeScriptAnalyzer:
    • 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
  • *.less files are analyzed with LessAnalyzer:
    • 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
  • *.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
  • *.css files are analyzed with CssAnalyzer:
    • 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
  • *.jsproj 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


2022-01-30 13:24