apple / swift-package-manager
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
plist
el
cmake
  • 14 extensions are included in analyses: swift, txt, h, md, c, json, m, gitignore, yaml, plist, el, py, mm, cmake
  • 5 criteria are used to exclude files from analysis:
    • exclude files with path like ".*/[.][a-zA-Z0-9_]+.*" (Hidden files and folders) (13 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) (38 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.

main56938 LOC (46%) 595 files
test49910 LOC (40%) 203 files
generated0 LOC (0%) 0 files
build and deployment46 LOC (<1%) 1 files
other16483 LOC (13%) 50 files
Main Code
All manually created or maintained source code that defines logic of the product that is run in a production environment.
cmake
el
Explore:   circles  |  sunburst
  • The following criteria are used to filter files:
    • files with paths like ".*".
  • 595 files match defined criteria (56,938 lines of code, 100.0% vs. main code):
    • 523 *.swift files (55,541 lines of code)
    • 31 *.c files (916 lines of code)
    • 29 *.h files (238 lines of code)
    • 5 *.yaml files (101 lines of code)
    • 1 *.cmake files (52 lines of code)
    • 1 *.py files (42 lines of code)
    • 3 *.m files (32 lines of code)
    • 1 *.mm files (11 lines of code)
    • 1 *.el files (5 lines of code)
  • " *.swift" is biggest, containing 97.55% of code.
  • " *.el" is smallest, containing 0.01% of code.


*.swift55541 LOC (97%) 523 files
*.c916 LOC (1%) 31 files
*.h238 LOC (<1%) 29 files
*.yaml101 LOC (<1%) 5 files
*.cmake52 LOC (<1%) 1 files
*.py42 LOC (<1%) 1 files
*.m32 LOC (<1%) 3 files
*.mm11 LOC (<1%) 1 files
*.el5 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 ".*/IntegrationTests?/.*".
    • files with any line of content like ".*/simpletest/.*".
  • 203 files match defined criteria (49,910 lines of code, 87.7% vs. main code):
    • 184 *.swift files (49,790 lines of code)
    • 9 *.m files (85 lines of code)
    • 7 *.h files (24 lines of code)
    • 3 *.c files (11 lines of code)
  • " *.swift" is biggest, containing 99.76% of code.
  • " *.c" is smallest, containing 0.02% of code.


*.swift49790 LOC (99%) 184 files
*.m85 LOC (<1%) 9 files
*.h24 LOC (<1%) 7 files
*.c11 LOC (<1%) 3 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 ".*/[.]gitignore".
    • files with paths like ".*/docker[-]compose[.]yaml".
  • 1 file matches defined criteria (46 lines of code, 0.1% vs. main code). All matches are in *.yaml files.


*.yaml46 LOC (100%) 1 files
Other Code
plist
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 ".*/[.]gitignore".
    • files with paths like ".*[.]txt".
    • files with paths like ".*/[Dd]ocumentation/.*".
    • files with paths like ".*/README[.][a-z0-9]+".
    • files with paths like ".*/[Ee]xamples/.*".
    • files with paths like ".*[.]plist".
    • files with paths like ".*/LICENSE[.][a-z0-9]+".
  • 50 files match defined criteria (16,483 lines of code, 28.9% vs. main code):
    • 12 *.json files (11,666 lines of code)
    • 32 *.md files (4,701 lines of code)
    • 4 *.plist files (83 lines of code)
    • 2 *.swift files (33 lines of code)
  • " *.json" is biggest, containing 70.78% of code.
  • " *.swift" is smallest, containing 0.2% of code.


*.json11666 LOC (70%) 12 files
*.md4701 LOC (28%) 32 files
*.plist83 LOC (<1%) 4 files
*.swift33 LOC (<1%) 2 files
Analyzers
Info about analyzers used for source code examinations.
  • *.swift files are analyzed with SwiftAnalyzer:
    • 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
  • *.c files are analyzed with CStyleAnalyzer:
    • 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
  • *.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
  • *.yaml 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
  • *.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
  • *.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
  • *.m 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
  • *.mm 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
  • *.el 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


2022-01-30 21:27