Code Maat Importer
Category: Importer (takes in a CSV generated by Code Maat and outputs cc.json)
The Codemaatimporter generates visualisation data from CodeMaat Temporal Coupling CSV data with header. You can find the analysing tool Code Maat on GitHub. As Code Maat looks at version control data, this should work independently of the used language. Note that the metrics generated here are edge metrics.
Supported (Edge) Metrics
Metric | Description |
---|---|
pairingRate |
percentage value of the chance that given files are committed together |
avgCommits |
amount of commits in which the given files were included |
Usage and Parameters
Parameter | Description |
---|---|
FILE |
codemaat coupling csv files |
-h, --help |
displays help |
-o, --outputFile=<outputFile> |
output File (or empty for stdout) |
-nc, --not-compressed |
safe uncompressed output file |
Usage: ccsh codemaatimport [-h] [-nc] [-o=<outputFile>] FILE...
Example
-
Create VCS Log file from your project, e.g. with Git
git log --pretty=format:'[%h] %an %ad %s' --since=<YYYY/MM/DD> --date=short --numstat > project.log ```
-
Analyse the Log with CodeMaat in ‘coupling’ mode
maat -c git -l project.log -a coupling > edges.csv
-
Convert csv file to cc.json format with CodeMaatImporter
ccsh codemaatimport edges.csv -o edges.cc.json
- Aggregate edge-attributes and insert them into the appropriate nodes attribute-list with EdgeFilter
ccsh edgefilter edges.cc.json -o visual_edges.cc.json
-
Merge the coupling data with the project metrics file while using the MergeFilter
ccsh merge visual_edges.cc.json metrics.cc.json -o merged.cc.json
- Visualizing
merged.cc.json
with Visualization
Example File Content
\$ cat project.log
[a9829640] Max Mustermann 2018-06-05 Set new logo
1 1 app/codeCharta.scss
[fc14b1e2] Max Mustermann 2018-06-05 Update cc-label position
4 2 app/codeCharta.html
25 15 app/codeCharta.scss
4 2 app/testVille.html
...
\$ cat edges.csv
entity,coupled,degree,average-revs
app/codeCharta.html, app/codeCharta.scss, 56, 10
app/testVille.html, app/codeCharta.html, 42, 8
...
\$ cat edges.cc.json
{
"projectName": "Sample Project with edges",
"apiVersion": "1.2",
"nodes": [
{
"name": "root",
"type": "Folder",
"attributes": {},
"children": []
}
],
"edges": [
{
"fromNodeName": "/root/app/codeCharta.html",
"toNodeName": "/root/app/codeCharta.scss",
"attributes": {
"pairingRate": 56,
"avgCommits": 10
}
},
{
"fromNodeName": "/root/app/testVille.html",
"toNodeName": "/root/app/codeCharta.html",
"attributes": {
"pairingRate": 42,
"avgCommits": 8
}
}
],
"attributeTypes": {
"edges": [
"pairingRate": "relative",
"avgCommits": "absolute"
]
}
}
\$ cat visual_edges.cc.json
{
"projectName": "Sample Project with edges",
"apiVersion": "1.2",
"nodes": [
{
"name": "root",
"type": "Folder",
"attributes": {},
"children": [
{
"name": "app",
"type": "Folder",
"attributes": {},
"children": [
{
"name": "codeCharta.html",
"type": "File",
"attributes": {
"pairingRate": 49,
"avgCommits": 18
}
},
{
"name": "codeCharta.scss",
"type": "File",
"attributes": {
"pairingRate": 56,
"avgCommits": 10
}
},
{
"name": "testVille.html",
"type": "File",
"attributes": {
"pairingRate": 42,
"avgCommits": 8
}
}
]
}
]
}
],
"edges": [
{
"fromNodeName": "/root/app/codeCharta.html",
"toNodeName": "/root/app/codeCharta.scss",
"attributes": {
"pairingRate": 56,
"avgCommits": 10
}
},
{
"fromNodeName": "/root/app/testVille.html",
"toNodeName": "/root/app/codeCharta.html",
"attributes": {
"pairingRate": 42,
"avgCommits": 8
}
}
],
"attributeTypes": {
"edges": [
"pairingRate": "relative",
"avgCommits": "absolute"
]
}
}