amazon-research / generalized-fairness-metrics
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
in
jsonl
gitmodules
  • 19 extensions are included in analyses: py, ipynb, tsx, ts, js, txt, json, rst, jsonnet, sh, md, css, in, gitignore, jsonl, bat, yml, gitmodules, html
  • 6 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (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 ".*/docs/.*" (Documentation) (6 files).
    • exclude files with path like ".*[.]txt" (Text files) (6 files).
    • exclude files with path like ".*/sokrates_conventions[.]json" (Sokrates scoping conventions) (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.

main6138 LOC (18%) 63 files
test4571 LOC (13%) 50 files
generated9385 LOC (27%) 1 files
build and deployment247 LOC (<1%) 4 files
other13405 LOC (39%) 10 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
in
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 63 files match defined criteria (6,138 lines of code, 100.0% vs. main code):
    • 36 *.py files (4,014 lines of code)
    • 6 *.ts files (792 lines of code)
    • 9 *.tsx files (751 lines of code)
    • 3 *.jsonnet files (262 lines of code)
    • 1 *.css files (197 lines of code)
    • 5 *.js files (66 lines of code)
    • 1 *.yml files (34 lines of code)
    • 1 *.html files (13 lines of code)
    • 1 *.in files (9 lines of code)
  • " *.py" is biggest, containing 65.4% of code.
  • " *.in" is smallest, containing 0.15% of code.


*.py4014 LOC (65%) 36 files
*.ts792 LOC (12%) 6 files
*.tsx751 LOC (12%) 9 files
*.jsonnet262 LOC (4%) 3 files
*.css197 LOC (3%) 1 files
*.js66 LOC (1%) 5 files
*.yml34 LOC (<1%) 1 files
*.html13 LOC (<1%) 1 files
*.in9 LOC (<1%) 1 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 ".*/[Tt]ests/.*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*_test[.].*".
    • files with any line of content like ".*/simpletest/.*".
  • 50 files match defined criteria (4,571 lines of code, 74.5% vs. main code):
    • 40 *.py files (3,891 lines of code)
    • 4 *.tsx files (431 lines of code)
    • 6 *.ts files (249 lines of code)
  • " *.py" is biggest, containing 85.12% of code.
  • " *.ts" is smallest, containing 5.45% of code.


*.py3891 LOC (85%) 40 files
*.tsx431 LOC (9%) 4 files
*.ts249 LOC (5%) 6 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 ".*/package[-]lock[.]json".
  • 1 file matches defined criteria (9,385 lines of code, 152.9% vs. main code). All matches are in *.json files.


*.json9385 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 ".*[.]sh".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitmodules".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]bat".
    • files with paths like ".*/package[.]json".
    • files with paths like ".*([.]|/)webpack([.]|/).*".
    • files with paths like ".*/package[-]lock[.]json".
  • 4 files match defined criteria (247 lines of code, 4.0% vs. main code):
    • 3 *.sh files (195 lines of code)
    • 1 *.js files (52 lines of code)
  • " *.sh" is biggest, containing 78.95% of code.
  • " *.js" is smallest, containing 21.05% of code.


*.sh195 LOC (78%) 3 files
*.js52 LOC (21%) 1 files
Other Code
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]md".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]json".
    • files with paths like ".*[.](rst|rest|resttxt|rsttxt)".
    • files with paths like ".*[.](xml|xsd|robot|sql|pgsql|dashboard|profile|ipynb|raml|avsc|al)".
  • 10 files match defined criteria (13,405 lines of code, 218.4% vs. main code):
    • 4 *.json files (9,704 lines of code)
    • 3 *.ipynb files (3,618 lines of code)
    • 3 *.md files (83 lines of code)
  • " *.json" is biggest, containing 72.39% of code.
  • " *.md" is smallest, containing 0.62% of code.


*.json9704 LOC (72%) 4 files
*.ipynb3618 LOC (26%) 3 files
*.md83 LOC (<1%) 3 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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
  • *.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
  • *.jsonnet 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
  • *.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
  • *.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
  • *.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
  • *.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
  • *.in files are analyzed with RustAnalyzer:
    • 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 23:16