A Leiningen plugin for static analysis to find unused code in Clojure applications and libraries.
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.
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.
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.
A Leiningen plugin for finding dead code
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.
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.
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.
Embraces the YAGNI principle to encourage lean codebases, helping developers proactively eliminate unnecessary code, aligning with the project's stated philosophy.
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.
Cannot detect dead code that is referenced dynamically or via reflection, potentially missing unused code in applications with complex runtime behavior.
Only warns about dead code without providing options to automatically delete it, leaving cleanup as a manual and potentially time-consuming task for developers.
Static analyzer and linter for Clojure code that sparks joy
There's a function for that!
Clojure lint tool
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.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.