SCM mining utility classes
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.
To install codemetrics, simply use pip:
pip install codemetrics
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)
Licensed under the term of MIT License. See attached file LICENSE.txt.
- Added cm.get_log function for concistency with the rest of the interface.
- Introduced GitProject and SvnProject to ease reference the tree, client and utility functions.
- Fixed handling of files with commas in the name.
- Fixed visualization of pandas example as html.
- Leveraged new pandas dtypes.
- Introduced type hints in code base.
- Switched backend to GitHub actions from travis-ci.
- Fixed incorrect usage of subprocess.run(). See https://github.com/elmotec/codemetrics/issues/1.
- Factored common logic between git and svn. Bug fixes.
- Fixed test_core following https://github.com/pandas-dev/pandas/pull/24748 (Pandas 0.25.X)
- Added script cm_func_stats that generates statistics on the function passed as argument.
- Added appveyor support for Windows.
- 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.
- Started changing interfaces to leverage apply and groupby.
- Added lines added/removed for Subversion.
- Added svn.get_diff_stats to retrieve line changes stats per diff.
- Integrated lizard to calculate average and function level cyclomatic complexity.
- Function oriented interface.
- Visualization via Vega, Altair.
- First release on PyPI.
Copyright (c) 2012-2019 elmotec
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size codemetrics-0.11.3-py2.py3-none-any.whl (29.2 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size codemetrics-0.11.3.tar.gz (49.7 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for codemetrics-0.11.3-py2.py3-none-any.whl