Package: contribution-complexity
Contribution ComplexityWhat 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 scalelow,moderate,medium,elevated,high.
That value identifies weather a contribution was simple to make (valuelow) or if it consists of multiple intricate changes (valuehigh) that were difficult to integrate into the system.For example, the storage engine ofApache Cassandra(DBMS) was refactored for version 3 to better support certain concepts of the query language and to allow for future performance optimizations, seeticketCASSANDRA-8099Thecorresponding commitmodifies almost 50k lines in 645 files and contains many non-trivial changes.
On the other hand abugthat prevented under certain circumstances streaming between cluster nodes was fixed with aquite tiny patchmodifying 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$pipinstallcontribution-complexityRunningYou can run the tool either by specifying a list of commits or by providing a regular expression that matches commit messages containing$contribcomplcommits<path_to_repo><commit_shas>...
$contribcomplissue<path_to_repo><issue_regex>...For example,$gitclonegit@github.com:apache/Cassandra.git/tmp/cassandra
$contribcomplcommits/tmp/cassandra021df085074b761f2b3539355ecfc4c237a54a762f1d6c7254342af98c2919bd74d37b9944c41a6b
ContributionComplexity.LOW
$contribcomplissue/tmp/cassandra'CASSANDRA-8099( |$)'ContributionComplexity.HIGHCalling from Codefromcontribution_complexity.computeimportfind_commits_for_issuefromcontribution_complexity.metricsimportcompute_contrib_complissue_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 ExperimentRequirementsVagrantwithDigitalOcean pluginADigitalOcean accountSSH keys registered with DigitalOceanThe SSH key name on an environment variableSSH_KEY_NAMEADigitalOcean API tokenon an environment variableDIGITAL_OCEAN_TOKENRun!Set your Github API key in theVagrantfile, i.e., replace<PUT_YOUR_KEY_HERE>on line 33 with your key.Runvagrant 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 withvagrant ssh) in the directory/vagrant/data/The experiment is described inexperiment/run_experiment.sh.AttributionThe logo is adapted from a [flaticon icon](onhttps://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:Icons made bymynamepongfromwww.flaticon.com