Git Product home page Git Product logo

unused's Introduction

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

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 Installation on M1 and Intel CPUs)

unused can be installed to use a memory allocator called mimalloc.
In local benchmarks (which are documented in the commit introducing mimalloc), it speeds up execution by a significant amount, but unfortunately runs into sporadic issues with segmentation faults on Apple M1 devices. For this reason, unused by default is installed without mimalloc on Macs, using the stock Rust allocator instead.

If you are using a Mac with an Intel chip and you wish to use mimalloc, you must specifically request it:

brew install unused --with-mimalloc

To completely refresh your install:

brew uninstall unused
brew untap unused-code/formulae
brew tap unused-code/formulae
brew install unused --with-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.

unused's People

Contributors

brandondrew avatar joshuaclayton avatar lrworth avatar maco avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.