Photo by National Cancer Institute on Unsplash
I am a huge fan of Adam Tornhill! I like the code-forensics approach to see how the team is behaving. Adam wrote a book about it: Your Code as a Crime Scene, and has built a tool to analyze data code-maat.
I have discovered a docker image based on this github repo, to easily do it.
As i am on Windows, i need to create a cofo.bat file at the root of my git repository
@echo off
setlocal enabledelayedexpansion
set args=%*
set wd="%cd::=%"
if "%args:~-2%" == "sh" (
docker run -it --rm -v /!wd:\=/!:/root/shared --entrypoint sh jdevoo/code-forensic
) else (
docker run -it --rm -v /!wd:\=/!:/root/shared -w /root/shared -p 3000:3000 -e COMMAND_DEBUG=true jdevoo/code-forensic %*
)
set wd=
set args=
and then through Powershell call it! It will output the list of available analysis:
Analysis tasks
* sloc-trend-analysis : Analyse the sloc trend in time for a particular file
* javascript-complexity-trend-analysis: Analyse the complexity trend in time for a particular javascript file
* ruby-complexity-trend-analysis : Analyse the complexity trend in time for a particular ruby file
* sum-of-coupling-analysis : Analyse the sum of coupling for each file
* temporal-coupling-analysis : Analyse the evolution of coupling in time for a particular file
* hotspot-analysis : Analyse the complexity and churn of source code to identify hotspots
* commit-message-analysis : Analyse the number of occurrencies of commit message words
* developer-effort-analysis : Analyse the distribution of effort (revisions) amongst developers/teams
* developer-coupling-analysis : Analyse the ownership and communication coupling between developers
* knowledge-map-analysis : Analyse the distribution of knowledge amongst developers/teams for each file
* system-evolution-analysis : Analyse the evolution and the coupling in time of different parts of your system
The parameters required for each analysis can be found on the github.
For example, if i want a developer-effort-analysis between 2019-01-01 and 2020-06-01, i need to
- create a gulpfile.js at the root of my git repository containing
require("code-forensics").configure(
{
repository: {
rootPath: ".",
},
},
{
dateFrom: "2019-01-01",
dateTo: "2020-06-01",
}
);
- execute
.\cofo.bat developer-effort-analysis
That's it! The analysis has been performed!
To view it, we need to execute
.\cofo.bat webserver
then using
docker ps -a
find the port mapping for the container !
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c5d2215b5586 jdevoo/code-forensic "gulp webserver" About a minute ago Up About a minute 0.0.0.0:32773->3000/tcp jolly_murdock
In this example it was 32773, so i navigate to http://localhost:32773 to view my reports !
Hope this helps !
Top comments (0)