microsoft / LightGBM
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
Rd
txt
i
in
cl
rda
cmake
vcxproj
editorconfig
Rmd
filters
gitmodules
  • 30 extensions are included in analyses: R, py, cpp, h, Rd, hpp, rst, md, yml, sh, svg, txt, i, json, ps1, in, cl, rda, cmake, cu, js, bat, vcxproj, editorconfig, ipynb, yaml, gitignore, Rmd, filters, gitmodules
  • 8 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (37 files).
    • exclude files with path like ".*/vignettes/.*" (R packages) (1 file).
    • exclude files with path like ".*/docs/.*" (Documentation) (31 files).
    • exclude files with path like ".*/docs?/_?(build|themes?|templates?|static)/.*" (Sphinx) (0 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) (3 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.

main47114 LOC (73%) 166 files
test12172 LOC (19%) 36 files
generated0 LOC (0%) 0 files
build and deployment165 LOC (<1%) 2 files
other4368 LOC (6%) 81 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
cl
i
cmake
vcxproj
filters
in
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 166 files match defined criteria (47,114 lines of code, 100.0% vs. main code):
    • 36 *.cpp files (16,628 lines of code)
    • 34 *.hpp files (8,879 lines of code)
    • 40 *.h files (7,003 lines of code)
    • 12 *.py files (5,772 lines of code)
    • 25 *.r files (3,744 lines of code)
    • 3 *.cl files (2,189 lines of code)
    • 2 *.cu files (995 lines of code)
    • 5 *.i files (571 lines of code)
    • 3 *.cmake files (416 lines of code)
    • 1 *.vcxproj files (344 lines of code)
    • 1 *.filters files (330 lines of code)
    • 3 *.in files (148 lines of code)
    • 1 *.yml files (95 lines of code)
  • " *.cpp" is biggest, containing 35.29% of code.
  • " *.yml" is smallest, containing 0.2% of code.


*.cpp16628 LOC (35%) 36 files
*.hpp8879 LOC (18%) 34 files
*.h7003 LOC (14%) 40 files
*.py5772 LOC (12%) 12 files
*.r3744 LOC (7%) 25 files
*.cl2189 LOC (4%) 3 files
*.cu995 LOC (2%) 2 files
*.i571 LOC (1%) 5 files
*.cmake416 LOC (<1%) 3 files
*.vcxproj344 LOC (<1%) 1 files
*.filters330 LOC (<1%) 1 files
*.in148 LOC (<1%) 3 files
*.yml95 LOC (<1%) 1 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
rda
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*/test_.*".
    • files with paths like ".*[.][Tt]est[.].*".
    • files with paths like ".*[.]test[.].*".
    • files with paths like ".*/[Tt]ests/.*".
    • files with any line of content like ".*/simpletest/.*".
  • 36 files match defined criteria (12,172 lines of code, 25.8% vs. main code):
    • 14 *.py files (6,708 lines of code)
    • 17 *.r files (5,039 lines of code)
    • 4 *.cpp files (300 lines of code)
    • 1 *.rda files (125 lines of code)
  • " *.py" is biggest, containing 55.11% of code.
  • " *.rda" is smallest, containing 1.03% of code.


*.py6708 LOC (55%) 14 files
*.r5039 LOC (41%) 17 files
*.cpp300 LOC (2%) 4 files
*.rda125 LOC (1%) 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 ".*/[.]gitignore".
    • files with paths like ".*/[.]gitmodules".
    • files with paths like ".*[.]bat".
  • 2 files match defined criteria (165 lines of code, 0.4% vs. main code). All matches are in *.sh files.


*.sh165 LOC (100%) 2 files
Other Code
rd
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 ".*/README[.][a-z0-9]+".
    • files with paths like ".*[.]editorconfig".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[Dd]emos?/.*".
    • files with paths like ".*/[Mm]an/.*".
    • files with paths like ".*[.]svg".
    • files with paths like ".*[.](rst|rest|resttxt|rsttxt)".
    • files with paths like ".*/[Ee]xamples/.*".
  • 81 files match defined criteria (4,368 lines of code, 9.3% vs. main code):
    • 38 *.rd files (1,654 lines of code)
    • 17 *.md files (1,309 lines of code)
    • 10 *.r files (672 lines of code)
    • 11 *.py files (520 lines of code)
    • 1 *.rst files (144 lines of code)
    • 1 *.svg files (41 lines of code)
    • 3 *.json files (28 lines of code)
  • " *.rd" is biggest, containing 37.87% of code.
  • " *.json" is smallest, containing 0.64% of code.


*.rd1654 LOC (37%) 38 files
*.md1309 LOC (29%) 17 files
*.r672 LOC (15%) 10 files
*.py520 LOC (11%) 11 files
*.rst144 LOC (3%) 1 files
*.svg41 LOC (<1%) 1 files
*.json28 LOC (<1%) 3 files
Analyzers
Info about analyzers used for source code examinations.
  • *.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
  • *.hpp 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
  • *.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
  • *.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
  • *.r files are analyzed with RAnalyzer:
    • 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
  • *.cl 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
  • *.cu 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
  • *.i 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
  • *.cmake 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
  • *.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
  • *.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
  • *.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


2022-01-30 13:49