bazelbuild / rules_rust
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
proto
patch
lds
  • 19 extensions are included in analyses: rs, bzl, md, sh, cc, toml, txt, h, c, proto, gitignore, patch, json, yaml, css, js, yml, inc, lds
  • 7 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (6 files).
    • exclude files with path like ".*/(3rd|[Tt]hird)[-_]?[Pp]arty/.*" (Dependencies) (2 files).
    • exclude files with path like ".*/docs/.*" (Documentation) (18 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) (13 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.

main18288 LOC (72%) 85 files
test5208 LOC (20%) 179 files
generated0 LOC (0%) 0 files
build and deployment124 LOC (<1%) 3 files
other1734 LOC (6%) 85 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 ".*".
  • 85 files match defined criteria (18,288 lines of code, 100.0% vs. main code):
    • 47 *.bzl files (13,086 lines of code)
    • 24 *.rs files (4,289 lines of code)
    • 4 *.cc files (665 lines of code)
    • 8 *.toml files (200 lines of code)
    • 2 *.h files (48 lines of code)
  • " *.bzl" is biggest, containing 71.56% of code.
  • " *.h" is smallest, containing 0.26% of code.


*.bzl13086 LOC (71%) 47 files
*.rs4289 LOC (23%) 24 files
*.cc665 LOC (3%) 4 files
*.toml200 LOC (1%) 8 files
*.h48 LOC (<1%) 2 files
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
proto
lds
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*_test[.].*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*/[Tt]ests/.*".
    • files with paths like ".*/[Tt]est/.*".
    • files with paths like ".*[-]test[-].*".
    • files with any line of content like ".*/simpletest/.*".
  • 179 files match defined criteria (5,208 lines of code, 28.5% vs. main code):
    • 39 *.bzl files (3,641 lines of code)
    • 115 *.rs files (1,185 lines of code)
    • 5 *.sh files (205 lines of code)
    • 11 *.cc files (154 lines of code)
    • 2 *.proto files (9 lines of code)
    • 2 *.c files (5 lines of code)
    • 2 *.h files (5 lines of code)
    • 1 *.lds files (2 lines of code)
    • 2 *.toml files (2 lines of code)
  • " *.bzl" is biggest, containing 69.91% of code.
  • " *.toml" is smallest, containing 0.04% of code.


*.bzl3641 LOC (69%) 39 files
*.rs1185 LOC (22%) 115 files
*.sh205 LOC (3%) 5 files
*.cc154 LOC (2%) 11 files
*.proto9 LOC (<1%) 2 files
*.c5 LOC (<1%) 2 files
*.h5 LOC (<1%) 2 files
*.lds2 LOC (<1%) 1 files
*.toml2 LOC (<1%) 2 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".
  • 3 files match defined criteria (124 lines of code, 0.7% vs. main code). All matches are in *.sh files.


*.sh124 LOC (100%) 3 files
Other Code
patch
proto
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 ".*[.]json".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/[Ee]xamples/.*".
    • files with paths like ".*/LICENSE[.][a-z0-9]+".
    • files with paths like ".*[.]patch".
  • 85 files match defined criteria (1,734 lines of code, 9.5% vs. main code):
    • 40 *.rs files (622 lines of code)
    • 8 *.bzl files (418 lines of code)
    • 15 *.md files (331 lines of code)
    • 3 *.c files (159 lines of code)
    • 5 *.toml files (70 lines of code)
    • 1 *.json files (34 lines of code)
    • 2 *.patch files (27 lines of code)
    • 2 *.proto files (26 lines of code)
    • 1 *.js files (19 lines of code)
    • 2 *.h files (18 lines of code)
    • 5 *.sh files (9 lines of code)
    • 1 *.inc files (1 lines of code)
  • " *.rs" is biggest, containing 35.87% of code.
  • " *.inc" is smallest, containing 0.06% of code.


*.rs622 LOC (35%) 40 files
*.bzl418 LOC (24%) 8 files
*.md331 LOC (19%) 15 files
*.c159 LOC (9%) 3 files
*.toml70 LOC (4%) 5 files
*.json34 LOC (1%) 1 files
*.patch27 LOC (1%) 2 files
*.proto26 LOC (1%) 2 files
*.js19 LOC (1%) 1 files
*.h18 LOC (1%) 2 files
*.sh9 LOC (<1%) 5 files
*.inc1 LOC (<1%) 1 files
Analyzers
Info about analyzers used for source code examinations.
  • *.bzl 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
  • *.rs 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
  • *.cc 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
  • *.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
  • *.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


2022-02-03 05:29