Skip to main content

SCM mining utility classes

Project description

PyPi version Python compatibility Travis master status AppVeyor master status Libraries.io dependency status for latest release Documentation Coverage Codacy

codemetrics

Mine your SCM for insight on your software. A work of love inspired by Adam Tornhill’s books.

Code metrics is a simple Python module that leverage pandas and your source control management (SCM) tool togenerate insight on your code base.

  • pandas: for data munching.

  • lizard: for code complexity calculation.

  • cloc.pl (script): for line counts from cloc

  • For now, only Subversion and git are supported.

Installation

To install codemetrics, simply use pip:

pip install codemetrics

Usage

This is a simple tool that makes it easy to retrieve information from your Source Control Management (SCM) repository and hopefully gain insight from it.

import codemetrics as cm
import cm.git

log_df = cm.get_git_log()
ages_df = cm.get_ages(log_df)

To retrieve the number of lines changed by revision with Subversion:

import codemetrics as cm
import cm.git

log_df = cm.get_svn_log().set_index(['revision', 'path'])
log_df.loc[:, ['added', 'removed']] = log_df.reset_index().\
                                         groupby('revision').\
                                         apply(cm.svn.get_diff_stats, chunks=False)

See module documentation for more advanced functions or the example notebook

License

Licensed under the term of MIT License. See attached file LICENSE.txt.

Credits

History

0.9.6 (2019-09-29)

0.9.5 (2019-09-05)

  • Factored common logic between git and svn. Bug fixes.

0.9.4 (2019-09-02)

0.9.3 (2019-04-01)

  • Fixed retrieval of added and removed lines when there are spaces in a file name.

  • Fixed indexed input in get_mass_changes.

  • Fixed handling of removed files in svn.get_diff_stats.

  • Fixed handling of branches in svn.get_diff_stats.

0.9 (2019-03-19)

  • Started changing interfaces to leverage apply and groupby.

  • Added lines added/removed for Subversion.

0.8.2 (2019-02-26)

  • Added svn.get_diff_stats to retrieve line changes stats per diff.

0.8 (2019-02-13)

  • Integrated lizard to calculate average and function level cyclomatic complexity.

0.7 (2019-01-09)

  • Function oriented interface.

  • Visualization via Vega, Altair.

  • Documentation.

0.6

  • Alpha work.

0.5 (2018-05-12)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codemetrics-0.9.6.tar.gz (55.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page