Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Clojure
  3. yagni

yagni

EPL-1.0Clojurev0.1.7

A Leiningen plugin for static analysis to find unused code in Clojure applications and libraries.

GitHubGitHub
223 stars10 forks0 contributors

What is yagni?

Yagni is a Leiningen plugin for Clojure that performs static code analysis to find and report dead code in applications and libraries. It helps developers maintain cleaner codebases by identifying unused vars and Java classes that are no longer reachable from project entrypoints.

Target Audience

Clojure developers working on applications or libraries who want to keep their codebases clean and free of unused code, particularly those using Leiningen as their build tool.

Value Proposition

Yagni provides a simple, integrated way to detect dead code in Clojure projects without manual inspection, supporting both Leiningen and deps.edn workflows with configurable entrypoints for different project structures.

Overview

A Leiningen plugin for finding dead code

Use Cases

Best For

  • Identifying unused functions and vars in Clojure applications
  • Cleaning up legacy codebases with accumulated dead code
  • Maintaining libraries by removing unreachable public APIs
  • Enforcing lean code practices in team projects
  • Preventing dead code accumulation during refactoring
  • Analyzing code reachability in multi-main Clojure programs

Not Ideal For

  • Projects using build tools other than Leiningen or deps.edn, such as Maven or Boot
  • Dynamic codebases with heavy use of eval or runtime code loading
  • Teams prioritizing rapid prototyping over code cleanup efforts

Pros & Cons

Pros

Accurate Dead Code Detection

Uses graph-based analysis to build a reference graph from entrypoints, ensuring precise identification of unused vars and Java classes, as described in the README's background section.

Configurable for Various Projects

Supports custom entrypoints via a .lein-yagni file, making it suitable for libraries and multi-main applications where default :main isn't sufficient, per the configuration details.

Easy Build Tool Integration

Runs seamlessly as a Leiningen plugin with 'lein yagni' and can be set up with deps.edn aliases, as shown in the installation and usage sections for flexible workflows.

Philosophy-Driven Design

Embraces the YAGNI principle to encourage lean codebases, helping developers proactively eliminate unnecessary code, aligning with the project's stated philosophy.

Cons

Manual Configuration Overhead

Requires creating and maintaining a .lein-yagni file for non-standard projects, which adds setup complexity and can lead to errors if entrypoints are misconfigured.

Limited to Static Analysis

Cannot detect dead code that is referenced dynamically or via reflection, potentially missing unused code in applications with complex runtime behavior.

No Auto-Removal Feature

Only warns about dead code without providing options to automatically delete it, leaving cleanup as a manual and potentially time-consuming task for developers.

Frequently Asked Questions

Quick Stats

Stars223
Forks10
Contributors0
Open Issues9
Last commit5 years ago
CreatedSince 2015

Tags

#code-cleanup#development-workflow#leiningen-plugin#clojure#static-analysis#build-tool#dead-code-detection

Built With

C
Clojure
L
Leiningen

Included in

Clojure2.8k
Auto-fetched 9 hours ago

Related Projects

clj-kondoclj-kondo

Static analyzer and linter for Clojure code that sparks joy

Stars1,852
Forks308
Last commit18 days ago
kibitkibit

There's a function for that!

Stars1,755
Forks128
Last commit2 years ago
eastwoodeastwood

Clojure lint tool

Stars1,083
Forks63
Last commit2 years ago
spectrumspectrum

Spectrum is a library for performing static analysis on Clojure code, leveraging clojure.spec annotations to detect type-like errors during compilation. It provides an optional, pragmatic layer of compile-time checking on top of spec, aiming to catch common bugs without requiring full spec coverage. ## Key Features - **Static Analysis** — Analyzes Clojure code at compile time to identify potential spec conform errors. - **Spec-Driven** — Uses existing clojure.spec annotations as a foundation for type-like checking. - **Pragmatic Design** — Prioritizes usability and speed over perfect correctness, aiming for low false positives. - **Incremental Checking** — Supports checking individual vars or forms, enabling flexible integration into workflows. - **Configurable Strictness** — Allows tuning of analysis strictness levels to balance thoroughness and performance. ## Philosophy Spectrum embraces a pragmatic approach, valuing a tool that catches 80% of bugs and is used daily over a theoretically perfect but impractical solution. It converges toward correctness while accepting limitations during development.

Stars603
Forks18
Last commit5 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub