Git Product home page Git Product logo

code-compass's Introduction

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.

Features

Use c/cheatsheet to have a quick reference of the available commands and their aim. Check the Release Checklist heading for more information about them.

Installation and Dependencies

Please run =c/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

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

https://ag91.github.io/blog/2021/02/11/emacs-as-your-code-compass-how-fragmented-is-the-knowledge-of-this-file/

word analysis

use case of coupling: generate todos for current file

integrate gource

https://ag91.github.io/blog/2021/03/19/emacs-as-your-code-compass-watch-history-with-gource/

file-churn icon

main contributors notification

functions complexity

License

GPLv3

Dependencies

d3:

License: BSD-3

Copyright 2010-2020 Mike Bostock

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

code-compass's People

Contributors

ag91 avatar blankspruce avatar larebsyed avatar ambirdsall-gogo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.