Skip to content

A set of code analyses that assist you in tackling software complexity

License

Notifications You must be signed in to change notification settings

BlankSpruce/code-compass

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Code compass

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.

Credits

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.

Installation and Dependencies

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

Limitations

The limitations I know:

  1. only Git support for now, but I am open to PRs (should be easy because code-maat partially support other VCS already)
  2. 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.
  3. most likely others I will eventually discover from the issues ;)

Release Checklist

Releasing this in the wild is exciting, but it will take some time. Here what you can expect.

install instructions and dependencies

hotspots

software complexity

code churn

change coupling

use case of coupling: find coupled files

code communication

code knowledge

code stability

fragmentation

word analysis

Contributing

If you have ideas or wishes, just open an issue and I will look into it! Thanks for caring.

Alternatives

  • 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.
  • ???

About

A set of code analyses that assist you in tackling software complexity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Emacs Lisp 98.8%
  • Python 1.2%