This package shall guide you in your software development within Emacs. For example, it will point at the code that requires your changes the most and it will suggest you who to ask for help when you are lost.
I have presented some of the capabilities of code-compass in this talk of EmacsConf2020.
A significant part of this project relies on code-maat and the bright mind of his author Adam Tornhill. His books are inspiring and a suggested read.
This project depends on the following external dependencies:
- Git
- Python
- Docker
- code-maat
- gnuplot/graph-cli
And the following Emacs packages:
- async.el
- dash.el
- f.el
- s.el
- simple-httpd
If you use use-package
and you are on a Linux system, this will take
care of the Emacs installation:
(use-package async)
(use-package dash)
(use-package f)
(use-package s)
(use-package simple-httpd)
(use-package code-compass
:load-path "~/.emacs.d/lisp")
For Docker, the Code Maat image, cloc and graph-cli run the following script:
# see here for how to install in systems different from Linux Debian: https://gist.github.com/rstacruz/297fc799f094f55d062b982f7dac9e41
sudo apt install docker.io;
sudo systemctl start docker;
# after you manage to run docker successfully
git clone https://github.com/adamtornhill/code-maat.git;
cd code-maat;
docker build -t code-maat-app .
sudo apt install cloc;
cd /tmp;
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py; # from here https://pip.pypa.io/en/stable/installing/
python get-pip.py --user
pip3 install --user graph-cli
For trying things out in a clean Emacs:
(require 'package)
(eval-and-compile
(setq
package-archives
'(("melpa-stable" . "https://stable.melpa.org/packages/")
("melpa" . "https://melpa.org/packages/")
("marmalade" . "https://marmalade-repo.org/packages/")
("org" . "https://orgmode.org/elpa/")
("gnu" . "https://elpa.gnu.org/packages/"))))
(package-initialize)
;;; Bootstrap use-package
;; Install use-package if it's not already installed.
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(setq use-package-always-ensure 't)
(require 'use-package)
(require 'diminish)
(require 'bind-key)
(use-package async)
(use-package dash)
(use-package f)
(use-package s)
(use-package simple-httpd)
emacs -Q -l /tmp/code-compass-minimal-setup.el -l ./code-compass.el
The limitations I know:
- only Git support for now, but I am open to PRs (should be easy because code-maat partially support other VCS already)
- Adam said that code-maat may fail for code bases larger than 5 million lines. Please report if you observe that is the case, we will find a solution.
- most likely others I will eventually discover from the issues ;)
Releasing this in the wild is exciting, but it will take some time. Here what you can expect.
- hotspots analysis: https://ag91.github.io/blog/2020/12/18/emacs-as-your-code-compass-finding-code-hotspots/
- hotspots evolution: https://ag91.github.io/blog/2020/12/24/emacs-as-your-code-compass-looking-at-hotspots-evolution/
If you have ideas or wishes, just open an issue and I will look into it! Thanks for caring.
- CodeScene: this is the code analysis tool of Adam Tornhill which organizations can use to manage their software and organizational complexity. Code-compass learns from CodeScene and adapts to empower you.
- code-risk: this is a set of scripts Noah Sussman’s uses to find quality issues in repositories. Code-compass includes these and make them easily accessible to you.
- code-forensics: this makes available code-maat analyses in a node application. Code-compass offers a subset of these for now and focuses more on supporting you while you edit your project. (Thanks @BlankSpruce to share this repository!)
- git-deps: this shows you dependencies between git commits. Hopefully code-compass will integrate this project to help you when, for example, you are struggling to identify the commit that broke your release.
- ???