Input data

Out input data is manifold:

  1. We use the scanned Java byte code to be able to reason on the impacts of our software system
  2. We need a size metric for the amount of code we're deleting. The good old lines of code metric is both dependable as well as easy to collect
  3. We need some measures for the ugliness of our system. For this, we simply use a static code analyser that delivers a number of issues
  4. We also want to have a look at the production usage of the existing code base. For this, we use Jacoco for determine the amount of calls in our code base
  5. Last, we need an indicator about the change frequency of the code base.

In [ ]:
SRC_DIR=r'C:\dev\repos\buschmais-spring-petclinic'

java -jar jacococli.jar report c:\Temp\jacoco\jacoco.exec --xml jacoco.xml --classfiles c:\dev\repos\buschmais-spring-petclinic\target\classes --html jacoco.html


In [53]:
from py2neo import Graph, Node, Relationship
g = Graph()


graph = Graph()

def add_problem(title, description, graph):
    tx = graph.begin()
    node = Node("Problem", title=title)
    result = tx.create(node)
    tx.commit()
    return node

def add_cause(title, description, parent_cause, graph):
    tx = graph.begin()
    cause = Node("Cause", title=title)
    result = tx.create(cause)
    rel = Relationship(cause, "CAUSES", parent_cause)
    tx.create(rel)
    tx.commit()
    return cause


n = add_problem("test", "testdesc", graph)
add_cause("cause", "causedesc", n, graph)


Out[53]:
(b9f940f:Cause {title:"cause"})