[PYTHON] I tried using git inspector

Installation

Download from the official website https://code.google.com/p/gitinspector/ and unzip. Requires git and Python 2.6 or higher, with CentOS 6.x yum is probably fine.

How to use

gitinspector.py [optional] [path to git repository]

The analysis result is output as standard, so if you want to save it in a file, use redirect.

gitinspector.py -f java,conf,css,html,js,properties,sh,vm,xml -F htmlembedded -THmrl /home/mriit/ITRM > /var/www/html/inspector_simple.html

Specify the extension of the file you want to analyze with -f separated by commas, specify the output format with -F, and the default is text format. The html format refers to jQuery etc. from the outside, and html embedded is the one that embeds them. There are officially various samples, some of which are listed below.

inspector_sample.png

For each author, the number of commits, the number of added lines, the number of deleted lines, the rate of change, the number of changed lines for each month (-W for each week), etc. are displayed.

An accident I don't understand ...

When I used it as it was, I got the error "git blame doesn't have e option". Confirmed that git 1.7.1 does not have -e in blame. There is a description in blame.py, so I decided to play with it.

It seems that you can't just scrape "-e"

After trying various things, -n seems to be the correct answer, so make the relevant part as follows

blame.py


blame_string = "git blame -n -w {0} ".format("-C -C -M" if hard else "") + \

Then, it seems that the author's name acquisition did not go well ... Is the following method taking an email from the output of git blame and taking the name of the author based on it?

blame.py


@staticmethod
        def get_author_email(string):
                author_email = re.search(" \((.*?)\d\d\d\d-\d\d-\d\d", string)
                return author_email.group(1).strip().lstrip("<").rstrip(">")

changes.py


def get_latest_author_by_email(self, name):
               return self.authors_by_email[name]

When I did git blame in my environment, the name of the author appears, so I thought that it would be better not to do that, so I changed the above method to return the name I got, and it worked. .. I think there is a more appropriate solution, but for the time being, this is it.

Summary

It's full of crap, but I'm glad I got the information from the repository for the time being. There may have been a problem with git as well. Look at this regularly when developing with git. If the period is short, it may be better to display it weekly.

Recommended Posts

I tried using git inspector
I tried using parameterized
I tried using argparse
I tried using mimesis
I tried using anytree
I tried using Summpy
I tried using coturn
I tried using Pipenv
I tried using matplotlib
I tried using "Anvil".
I tried using Hubot
I tried using ESPCN
I tried using openpyxl
I tried using Ipython
I tried using PyCaret
I tried using cron
I tried using ngrok
I tried using face_recognition
I tried using Jupyter
I tried using PyCaret
I tried using Heapq
I tried using doctest
I tried using folium
I tried using jinja2
I tried using folium
I tried using time-window
[I tried using Pythonista 3] Introduction
I tried using easydict (memo).
I tried face recognition using Face ++
I tried using Random Forest
I tried using BigQuery ML
[Python] I tried using OpenPose
I tried using magenta / TensorFlow
I tried using AWS Chalice
I tried using Slack emojinator
I tried using Rotrics Dex Arm # 2
I tried using Rotrics Dex Arm
I tried using GrabCut of OpenCV
I tried server-client communication using tmux
I tried reinforcement learning using PyBrain
I tried deep learning using Theano
Somehow I tried using jupyter notebook
[Kaggle] I tried undersampling using imbalanced-learn
I tried shooting Kamehameha using OpenPose
I tried using the checkio API
[Python] I tried using YOLO v3
I tried asynchronous processing using asyncio
I tried using Amazon SQS with django-celery
I tried scraping
I tried PyQ
I tried playing a ○ ✕ game using TensorFlow
I tried using YOUTUBE Data API V3
I tried using Selenium with Headless chrome
I tried drawing a line using turtle
I tried using Bayesian Optimization in Python
I tried to classify text using TensorFlow
I tried using Selective search as R-CNN
I tried using UnityCloudBuild API from Python
I tried papermill
I tried django-slack
I tried using Headless Chrome from Selenium