Tools for Getting Familiar With a New Codebase

Getting to know a new codebase takes time. Some tools can help make this learning process faster.

cloc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ npm install -g cloc # install
$ cloc .
7 text files.
classified 7 files
6 unique files.
3 files ignored.

github.com/AlDanial/cloc v 1.74 T=0.03 s (165.0 files/s, 29047.8 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
JSON 3 0 0 534
JavaScript 1 31 21 263
Markdown 1 10 0 21
-------------------------------------------------------------------------------
SUM: 5 41 21 818
-------------------------------------------------------------------------------

cloc scans a repository and prints a summary of how many lines of code it contains.
It’s interesing to check out bigger repostiroies and check how many files and lines of code it contains.
It can put into perspective the scale of a given project.

Madge

1
2
3
4
5
$ npm -g install madge
$ madge --image graph.svg path/src/app.js

Processed 1 file (452ms) (1 warning)
✔ Image created at graph.svg

Madge is a developer tool for generating a visual graph of your module dependencies, finding circular dependencies, and give you other useful info.

gource

V8 example

1
$ gource .

gource creates an animation of the selected repository.
You can follow how a repository was built how file structure changed and how many people how frequently changed it.