Inspired by "Your Code as a Crime Scene" by Adam Tornhill (yet to be read)
This script helps to identify "hotspots" in your codebase by listing files frequently adjusted in commits related to bug fixes or other issues. These files are often the most complex and error-prone parts of your codebase, and might be good candidates for refactoring or further investigation.
The tool is versatile enough to handle any type of commit description and time frame you might be interested in exploring.
To get hotspot up and running on your machine, follow these steps:
Make sure you have git
and sed
installed on your system, as they are essential for the script to function correctly.
- Clone the repository:
git clone https://github.com/djursing/hotspot.git
- Navigate to the repository:
cd hotspot
- Make the script executable:
chmod +x hotspot.sh
- Move to local bin folder:
mv ./hotspot.sh /usr/local/bin/hotspot
- PATH (optional):
Make sure your path includes/usr/local/bin
Here are some ways to do it with.profile
and.bashrc
.
# ~/.profile
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
# ~/.bashrc
export PATH=$PATH:/usr/local/bin
hotspot.sh [-g|--grep GREP_STRING] [-s|--since SINCE_DATE]
-g, --grep
Extended Regex pattern to grep in commit messages.
Follows git log -E --grep definition.
Default is 'fix|bug'.
-s, --since
Time frame for the log search.
Follows git log --since definition.
Default is '1 year'.