unused/README.md
2016-05-11 22:32:19 -04:00

1.5 KiB

Unused

A command line tool in Haskell to identify unused code.

Image of Unused Output

Installing

Homebrew

You can install my formulae via Homebrew with brew tap:

brew tap joshuaclayton/formulae

Next, run:

brew install unused

Alternatively, you can install by hand.

Stack

This project uses Haskell and Stack.

Once you have these tools installed:

stack setup
stack install

This will generate a binary in $HOME/.local/bin; ensure this directory is in your $PATH.

Using Unused

unused reads from a pipe expecting a series of tokens to search the codebase for.

This could be done with echo:

echo "module\nimport" | unused

Or pulling in a ctags file:

cat .git/tags | cut -f1 | sort -u | unused

My end goal is to have the latter rolled up into unused itself, so you can navigate to a directory, run unused, and everything works as expected.

Requirements

Unused leverages Ag to analyze the codebase; as such, you'll need to have ag available in your $PATH. This is set as an explicit dependency in Homebrew.

Testing

To run the test suite, run:

stack test

License

Copyright 2016 Josh Clayton. See the LICENSE.