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.
Use code-compass-cheatsheet
to have a quick reference of the available commands and their aim.
Check the Release Checklist
heading for more information about them.
Please run =code-compass-doctor= if you encounter errors in running this tool
Note: I label dependencies as optional when the commands needing the dependency warn you they cannot execute because the dependency is missing.
This project depends on the following external dependencies:
- Git
- Python 3
- Java 8 or above
- code-maat
- cloc
- graph-cli (optional - only few commands will not succeed)
- gource (optional)
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:
# Docker is only necessary if you want to use that instead of the (automatically downloaded) JAR file
# 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 # https://github.com/mcastorina/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/
- hotspots analysis for microservices: https://ag91.github.io/blog/2021/04/08/emacs-as-your-code-compass-find-hotspots-in-micro-services/
d3:
License: BSD-3
Copyright 2010-2020 Mike Bostock
If you have ideas or wishes, just open an issue and I will look into it! Thanks for caring.
Functions without side effects have tests in their documentation.
To run those install https://github.com/ag91/doctest (at the time of
writing my fork as enhancements over the original) and run doctest
.
- 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.
- ???