azure / sonic-buildimage-msft
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
ini
profile
mk
patch
yang
cfg
txt
pub
vimrc
in
gitmodules
bashrc
lds
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.

main808151 LOC (60%) 4,055 files
test121560 LOC (9%) 199 files
generated0 LOC (0%) 0 files
build and deployment32197 LOC (2%) 592 files
other370831 LOC (27%) 2,946 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
cfg
yang
profile
bashrc
lds
pub
in
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 4055 files match defined criteria (808,151 LOC, 100.0% vs. main code):
    • 717 *.c files (410,751 LOC)
    • 2,095 *.py files (272,916 LOC)
    • 310 *.h files (43,974 LOC)
    • 127 *.yaml files (30,183 LOC)
    • 69 *.xml files (21,090 LOC)
    • 36 *.cfg files (14,954 LOC)
    • 106 *.yang files (10,757 LOC)
    • 9 *.cpp files (1,770 LOC)
    • 576 *.profile files (1,144 LOC)
    • 1 *.cc files (345 LOC)
    • 1 *.pl files (178 LOC)
    • 1 *.bashrc files (64 LOC)
    • 1 *.lds files (19 LOC)
    • 5 *.pub files (5 LOC)
    • 1 *.in files (1 LOC)
  • " *.c" is biggest, containing 50.83% of LOC.
  • " *.in" is smallest, containing 0% of LOC.


*.c410751 LOC (50%) 717 files
*.py272916 LOC (33%) 2,095 files
*.h43974 LOC (5%) 310 files
*.yaml30183 LOC (3%) 127 files
*.xml21090 LOC (2%) 69 files
*.cfg14954 LOC (1%) 36 files
*.yang10757 LOC (1%) 106 files
*.cpp1770 LOC (<1%) 9 files
*.profile1144 LOC (<1%) 576 files
*.cc345 LOC (<1%) 1 file
*.pl178 LOC (<1%) 1 file
*.bashrc64 LOC (<1%) 1 file
*.lds19 LOC (<1%) 1 file
*.pub5 LOC (<1%) 5 files
*.in1 LOC (<1%) 1 file
Test Code
Used only for testing of the product. Normally not deployed in a production environment.
yang
mk
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[-]tests/.*".
    • files with paths like ".*/test_.*".
    • files with paths like ".*/[Tt]ests/.*".
    • files with paths like ".*[-]test[-].*".
    • files with paths like ".*/mock[a-zA-Z0-9_\- ]+/.*".
    • files with paths like ".*_test[.].*".
    • files with paths like ".*/tests_.*".
    • files with paths like ".*/[Tt]est/.*".
  • 199 files match defined criteria (121,560 LOC, 15.0% vs. main code):
    • 61 *.xml files (104,791 LOC)
    • 122 *.py files (15,092 LOC)
    • 2 *.cpp files (677 LOC)
    • 6 *.yang files (560 LOC)
    • 3 *.c files (314 LOC)
    • 4 *.sh files (117 LOC)
    • 1 *.mk files (9 LOC)
  • " *.xml" is biggest, containing 86.21% of LOC.
  • " *.mk" is smallest, containing 0.01% of LOC.


*.xml104791 LOC (86%) 61 files
*.py15092 LOC (12%) 122 files
*.cpp677 LOC (<1%) 2 files
*.yang560 LOC (<1%) 6 files
*.c314 LOC (<1%) 3 files
*.sh117 LOC (<1%) 4 files
*.mk9 LOC (<1%) 1 file
Build and Deployment Code
Source code used to configure or support build and deployment process.
mk
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]sh".
    • files with paths like ".*[.]mk".
    • files with paths like ".*[.]git[a-z]+".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*/[.]gitmodules".
  • 592 files match defined criteria (32,197 LOC, 4.0% vs. main code):
    • 284 *.sh files (25,147 LOC)
    • 308 *.mk files (7,050 LOC)
  • " *.sh" is biggest, containing 78.1% of LOC.
  • " *.mk" is smallest, containing 21.9% of LOC.


*.sh25147 LOC (78%) 284 files
*.mk7050 LOC (21%) 308 files
Other Code
patch
ini
txt
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*[.]ini".
    • 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 ".*/[.]dockerignore".
    • files with paths like ".*/[.]gitignore".
    • files with paths like ".*[.]patch".
    • files with paths like ".*[.](rst|rest|resttxt|rsttxt)".
  • 2946 files match defined criteria (370,831 LOC, 45.9% vs. main code):
    • 1,430 *.json files (285,373 LOC)
    • 231 *.patch files (39,256 LOC)
    • 1,208 *.ini files (37,400 LOC)
    • 54 *.md files (4,443 LOC)
    • 18 *.txt files (4,325 LOC)
    • 5 *.rst files (34 LOC)
  • " *.json" is biggest, containing 76.96% of LOC.
  • " *.rst" is smallest, containing 0.01% of LOC.


*.json285373 LOC (76%) 1,430 files
*.patch39256 LOC (10%) 231 files
*.ini37400 LOC (10%) 1,208 files
*.md4443 LOC (1%) 54 files
*.txt4325 LOC (1%) 18 files
*.rst34 LOC (<1%) 5 files
Analyzers
Info about analyzers used for source code examinations.


2025-05-06 22:15