Giter Club home page Giter Club logo

mix_unused's Introduction

Mix Unused

Mix compiler tracer for detecting unused public functions.

Installation

def deps do
  [
    {:mix_unused, "~> 0.3.0"}
  ]
end

The docs can be found at https://hexdocs.pm/mix_unused.

Usage

After installation you need to add :unused as a compiler to the list of Mix compilers:

defmodule MySystem.MixProject do
  use Mix.Project

  def project do
    [
      compilers: [:unused] ++ Mix.compilers(),
      # In case of Phoenix projects you need to add it to the list
      # compilers: [:unused, :phoenix, :gettext] ++ Mix.compilers()
      # ...
    ]
  end

  # ...
end

Warning

This isn't perfect solution and this will not find dynamic calls in form of:

apply(mod, func, args)

So this mean that, for example, if you have custom child_spec/1 definition then mix unused can return such function as unused even when you are using that indirectly in your supervisor.

Configuration

You can define used functions by adding mfa in unused: [ignored: [⋯]] in your project configuration:

def project do
  [
    # ⋯
    unused: [
      ignore: [
        {MyApp.Foo, :child_spec, 1}
      ]
    ],
    # ⋯
  ]
end

License

See LICENSE.

mix_unused's People

Contributors

hauleth avatar noozo avatar

Watchers

James Cloos avatar  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.