Bionik6 / unused

A tool to identify potentially unused code.

Home Page:https://unused.codes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unused

CI Security audit

Unused identifies unused code in Rails, Phoenix, and other types of applications, improving developer productivity

Screenshot of Unused Output

Installing and Updating

Homebrew (Recommended)

You can install the formulae via Homebrew with brew tap:

brew tap unused-code/formulae

Next, run:

brew install unused

This will install unused and its corresponding dependencies.

Updating

To update, run:

brew update
brew upgrade unused

Caveats (Apple M1 Installation)

By default, unused leverages a different memory allocator called mimalloc. For my local benchmarks, it speeds up execution by a significant amount (which is documented in the commit introducing mimalloc), but currently runs into sporadic issues on Apple M1 devices.

If you run into issues with segmentation faults, consider reinstalling unused with the stock Rust allocator.

To refresh your install:

brew uninstall unused
brew untap unused-code/formulae
brew tap unused-code/formulae
brew install unused --without-mimalloc

Nix

There is a Nix expression available in nixpkgs.

There are many ways to run unused with Nix, but the simplest is:

nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz -p unused --run 'unused --help'

Linux

Precompiled binaries are available for the latest release.

Download the linux-musl binary, and move the binary to somewhere within your $PATH.

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.

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.

Usage

From your project directory, run:

unused

This will generate a list of tokens and corresponding definition locations for removal consideration.

You can see supported command-line flags with:

unused --help

Troubleshooting

If you run into trouble, run

unused doctor

This will perform a series of simple checks to help identify obvious issues with configuration.

License

Copyright 2020 Josh Clayton. See the LICENSE.

About

A tool to identify potentially unused code.

https://unused.codes

License:MIT License


Languages

Language:Rust 100.0%