diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4da0b6a..70791c8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -120,21 +120,21 @@ jobs: echo "release version: $RELEASE_VERSION" - name: Build release binary - run: ${{ env.CARGO }} build --verbose --release --bin unused-rs ${{ env.TARGET_FLAGS }} + run: ${{ env.CARGO }} build --verbose --release --bin unused ${{ env.TARGET_FLAGS }} - name: Strip release binary (Linux and macOS) if: matrix.build == 'linux' || matrix.build == 'macos' - run: strip "target/${{ matrix.target }}/release/unused-rs" + run: strip "target/${{ matrix.target }}/release/unused" - name: Build archive shell: bash run: | - staging="unused-rs-${{ env.RELEASE_VERSION }}-${{ matrix.target }}" + staging="unused-${{ env.RELEASE_VERSION }}-${{ matrix.target }}" mkdir -p "$staging" cp {README.md,LICENSE} "$staging/" - cp "target/${{ matrix.target }}/release/unused-rs" "$staging/" + cp "target/${{ matrix.target }}/release/unused" "$staging/" tar czf "$staging.tar.gz" "$staging" echo "::set-env name=ASSET::$staging.tar.gz" diff --git a/Cargo.toml b/Cargo.toml index 1913c12..e0889ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ name = "tracked-files-rs" path = "src/bin/codebase_files.rs" [[bin]] -name = "unused-rs" +name = "unused" path = "src/bin/unused.rs" [workspace] diff --git a/README.md b/README.md index afcafc9..609bde0 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,82 @@ ![CI](https://github.com/unused-code/unused_rs/workflows/CI/badge.svg) ![Security audit](https://github.com/unused-code/unused_rs/workflows/Security%20audit/badge.svg) -Unused identifies possible dead code in dynamic programming languages. +Unused identifies unused code in Rails, Phoenix, and other types of +applications, improving developer productivity -The first version of this was written in Haskell, available [here]. +![Screenshot of Unused Output](https://unused.codes/images/unused-output.png) -[here]: https://github.com/joshuaclayton/unused +## Installing and Updating + +### Homebrew (Recommended) + +You can install [the formulae] via [Homebrew] with `brew tap`: + +```sh +brew tap unused-code/formulae +``` + +Next, run: + +```sh +brew install unused +``` + +[the formulae]: https://github.com/unused-code/formulae +[Homebrew]: http://brew.sh/ + +This will install `unused` and its corresponding dependencies. + +To update, run: + +```sh +brew update +brew upgrade unused +``` + +## Prerequisites + +It is strongly recommended you install [Universal Ctags] to generate tags +files. Universal Ctags supports more languages and has native parsers for a +good number of them, resulting in faster tags generation time. + +[Universal Ctags]: https://ctags.io/ + +It is also recommended that you have a tags file generated on a semi-regular +basis. Tim Pope wrote an article about [wiring up ctags generation] with a [git +hook]. thoughtbot's dotfiles also reference a [ctags git hook]. + +[wiring up ctags generation]: https://tbaggery.com/2011/08/08/effortless-ctags-with-git.html +[git hook]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks +[ctags git hook]: https://github.com/thoughtbot/dotfiles/blob/master/git_template/hooks/ctags + +## Usage + +From your project directory, run: + +```sh +unused +``` + +This will generate a list of tokens and corresponding definition locations for +removal consideration. + +You can see supported command-line flags with: + +```sh +unused --help +``` + +## Troubleshooting + +If you run into trouble, run + +```sh +unused doctor +``` + +This will perform a series of simple checks to help identify obvious issues +with configuration. ## License