Contribution Complexity
What is this?
This tool computes the complexity of a specified contribution to a git repository. A contribution is one or more commits specified by their commit hashes. Alternatively, if commit messages contain references to issue numbers, a contribution can be specified by a regular expression matching a certain set of commits.
The tool reports a contribution complexity on the scale low, moderate, medium, elevated, high.
That value identifies weather a contribution was simple to make (value low) or if it consists of multiple intricate changes (value high) that were difficult to integrate into the system.
For example, the storage engine of Apache Cassandra (DBMS) was refactored for version 3 to better support certain concepts of the query language and to allow for future performance optimizations, see ticket CASSANDRA-8099
The corresponding commit modifies almost 50k lines in 645 files and contains many non-trivial changes.
On the other hand a bug that prevented under certain circumstances streaming between cluster nodes was fixed with a quite tiny patch modifying 15 lines in two files.
For humans inspecting the two contributions it is quickly clear that the former contribution is way more complex to implement than the latter.
This tool is meant to automate the process of identification of contributions of various complexities either for inclusion in a CI setup or for research.
Installation
$ pip install contribution-complexity
Running
You can run the tool either by specifying a list of commits or by providing a regular expression that matches commit messages containing
$ contribcompl commits <path_to_repo> <commit_shas>...
$ contribcompl issue <path_to_repo> <issue_regex>...
For example,
$ git clone git@github.com:apache/Cassandra.git /tmp/cassandra
$ contribcompl commits /tmp/cassandra 021df085074b761f2b3539355ecfc4c237a54a76 2f1d6c7254342af98c2919bd74d37b9944c41a6b
ContributionComplexity.LOW
$ contribcompl issue /tmp/cassandra 'CASSANDRA-8099( |$)'
ContributionComplexity.HIGH
Calling from Code
from contribution_complexity.compute import find_commits_for_issue
from contribution_complexity.metrics import compute_contrib_compl
issue_re = "CASSANDRA-8099( |$)"
path_to_repo = "/tmp/cassandra"
commit_shas = find_commits_for_issue(path_to_repo, issue_re)
contribcompl = compute_contrib_compl(path_to_repo, commit_shas)
print(contribcompl)
Recreating the Experiment
Requirements
- Vagrant with DigitalOcean plugin
- A DigitalOcean account
- SSH keys registered with DigitalOcean
- The SSH key name on an environment variable
SSH_KEY_NAME - A DigitalOcean API token on an environment variable
DIGITAL_OCEAN_TOKEN
Run!
- Set your Github API key in the
Vagrantfile, i.e., replace<PUT_YOUR_KEY_HERE>on line 33 with your key. - Run
vagrant upin this directory, which will bring up and configure a VM accordingly. It will automatically start the experiment recreation, which will take some hours to run. - Once done you have all results on the VM (log onto the machine with
vagrant ssh) in the directory/vagrant/data/
The experiment is described in experiment/run_experiment.sh.
Attribution
The logo is adapted from a [flaticon icon](on https://www.flaticon.com/free-icon/puzzle_808497?term=contribution&page=1&position=16&page=1&position=16&related_id=808497&origin=search). Proper attribution to the original:
Metadata
Release files for contribution-complexity 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| contribution-complexity-0.1.1.tar.gz | 11.1 kB | Without provenance | Details for contribution-complexity-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| contribution_complexity-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for contribution_complexity-0.1.1-py3-none-any.whl |
Total release size: 21.3 kB
Release files / contribution-complexity-0.1.1.tar.gz
| Download URL | contribution-complexity-0.1.1.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9c910bfa5095804a737159560235ac8a2b0fa819896a46d1181ca836fb37e77
|
|
BLAKE2b-256 checksum How to use checksums |
43248518c20db0971df7100fd7ad61c6a54eafc27cc4d1c6d19521dc99ed2b59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.0 Darwin/18.7.0
|
Release files / contribution_complexity-0.1.1-py3-none-any.whl
| Download URL | contribution_complexity-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c91576191136ddb6dab54a62afdfa5048d2c4b63c0f65e1f2019e899a1e244c7
|
|
BLAKE2b-256 checksum How to use checksums |
df62b3f34226866246dd3a9da47bdd0b883c22e7e0eff50f250a316f447ba48e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.0 Darwin/18.7.0
|
Security for contribution-complexity 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.