mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-08-15 15:50:26 +03:00
Deprecated; see https://github.com/unused-code/unused
2650e1f040
Why? ==== A simple calculation ("yes, this should be removed" or "no, this is probably fine") is frankly not enough information for someone evaluating their codebase to understand why we made the decision. This introduces a removal reason, so a user understands why we ranked it the way we did, and adds additional logic around a method and its tests to determine if a method exists and is only being used in the tests (if so, it should probably be deleted). This is done with an Occurrances record, which is created for total files, test code, and non-test code. The test code logic is somewhat naive but works in most cases. It doesn't ensure a particular directory, in the case that tests live alongside source code (e.g. Go), and captures RSpec cases as well. |
||
---|---|---|
app | ||
src/Unused | ||
test | ||
.gitignore | ||
LICENSE | ||
README.md | ||
Setup.hs | ||
stack.yaml | ||
unused.cabal |
Unused
A command line tool in Haskell to identify unused code.
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.
Building and Compiling
This project uses Haskell and Stack.
Once you have these tools installed:
stack install
This will generate a binary in $HOME/.local/bin
; ensure this directory is in
your $PATH
.
Testing
To run the test suite, run:
stack test
License
Copyright 2016 Josh Clayton. See the LICENSE.