ProductPromotion
Logo

Clojure

made by https://0x3d.site

GitHub - venantius/yagni: A Leiningen plugin for finding dead code
A Leiningen plugin for finding dead code. Contribute to venantius/yagni development by creating an account on GitHub.
Visit Site

GitHub - venantius/yagni: A Leiningen plugin for finding dead code

GitHub - venantius/yagni: A Leiningen plugin for finding dead code

Yagni

Build Status Dependency Status Clojars Project

Yagni - You Aren't Gonna Need It.

Yagni is a static code analyzer that helps you find unused code in your applications and libraries.

I've written a blog post describing Yagni in greater depth here.

Background

No matter how it happens, sooner or later an application is going to end up with unused code. It's time to call Yagni, the exterminator.

Yagni works by identifying all of the interned vars and declared Java classes in the namespaces findable within your :source-paths, and then walking the forms of those vars and declarations.

As it walks the forms, it builds a graph of references to other vars and declarations. It then searches the graph from a set of entrypoints (by default your project's :main method), and emits warnings for anything that it couldn't find in the graph's search.

Installation

Merge the following into your ~/.lein/profiles.clj:

{:user {:plugins [[venantius/yagni "0.1.7"]]}}

Usage

To have Yagni search for dead code, just run:

$ lein yagni

Usage from deps.edn

You can also use Yagni via a deps.edn alias. Merge this with your deps.edn:

{:aliases {:yagni
           {:extra-deps {venantius/yagni {:mvn/version "0.1.7"}}
            :exec-fn yagni.core/run-yagni
            :exec-args {:source-paths ["src/clj"]
                        :main your.project}}}

And then run:

$ clj -X:yagni

Configuration

Yagni works by searching your codebase from an initial set of entrypoints. By default, Yagni assumes that the only entrypoint for your project is the one listed in your project.clj's :main key. Obviously, this is only useful for applications and tools with CLI invocations.

As libraries, multi-main programs, and certain other types of projects either tend to have no :main or many entrypoint methods, you can instead enumerate a list of entrypoints for your project in a .lein-yagni file in the root directory of your project. Feel free to take a look at the one in this project as an example.

Examples

Running lein yagni on the sample project located here will emit the following output:

$ lein yagni
=================== WARNING: Parents ======================
== Could not find any references to the following vars. ===
===========================================================

secondns/func-the-second

================== WARNING: Children ======================
== The following vars have references to them, but their ==
== parents do not.                                       ==
===========================================================

secondns/notafunc

Contributing

In general, bug reports, fixes, and code cleanup are always appreciated. Feature requests are liable to be subject to a bit more discussion.

When filing issues, please include the following:

  • The operating system
  • The JDK version
  • The Leiningen version
  • The Clojure version
  • Any plugins and dependencies in your project.clj and your ~/.lein/profiles.clj

License

Copyright © 2018 W. David Jarvis

Distributed under the Eclipse Public License, the same as Clojure.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory