SwifterSwift / SwiftMeter

[WIP] Script to create statistical reports about Swift codebases
MIT License
8 stars 3 forks source link
analytics badge code-analysis python statistical-reports swift swift-codebases swift-files swifterswift

SwiftMeter

[WIP] Script to create statistical reports about Swift codebases

Installation

Usage

Analytics for a single swift file

python meter.py -f path_to_swift_file

Get analytics for all swift files in a directory

python meter.py -d path_to_sources_directory

This will iterate over all swift files in the given directory and its subdirectories recursively

Create shields.io badges for the README

Add the -b flag to the end to create shields.io badges.

python meter.py -d path_to_sources_directory -b

Output the results into a file

python meter.py -d path_to_sources_directory -o file_path_to_export

Verbose logging

Add the -v flag to the end to create log verbose messages while processing swift files.

python meter.py -d path_to_sources_directory -v

Help

To learn more about usage use the -h flag

python meter.py -h

Example output

Swift codebase statistics:
{
    "swift_files": 56,
    "total_lines": 8941,
    "code_lines": 4207,
    "enums": 6,
    "classes": 0,
    "structs": 5,
    "extensions": 101,
    "functions": 229,
    "static_functions": 40,
    "variables": 220,
    "static_variables": 502,
    "ib_inspectables": 28,
    "initializers": 10,
    "failable_initializers": 9,
    "operators": 11,
    "total_non_static_units": 468,
    "total_static_units": 542,
    "total_units": 1010
}

Found an Issue?

If you find a bug or a mistake in the source code, you can help us by submitting an issue. Even better you can submit a Pull Request with a fix!

License

SwiftMeter is released under the MIT License.