Carve is a code cleanup utility for Clojure projects. It identifies unused variables and functions, helping developers remove unnecessary code and simplify their applications.
The software uses clj-kondo to analyse source code and determine which definitions are no longer referenced. It then uses rewrite-cljc to modify the source files. This combination allows Carve to identify potentially redundant code and make targeted changes rather than requiring developers to search through projects manually.
Carve is particularly useful when maintaining older applications, reorganising namespaces or removing functionality that is no longer required. Developers can review proposed changes interactively or generate reports before modifying their source files.
Care is needed when removing code, especially where functions are accessed dynamically or referenced by tests. Carve provides several options for controlling its analysis and protecting definitions that should be retained.
This is free and open source software.
Key Features
- Unused code detection – identifies Clojure vars that are not referenced elsewhere in the analysed source code.
- Automatic removal – removes unused definitions directly from source files using rewrite-cljc.
- Interactive mode – individually review unused vars and decide whether to remove, ignore or retain them.
- Dry-run mode – display proposed removals without modifying source files.
- Namespace cleanup – removes unused references from namespace :require declarations.
- Ignore lists – exclude specific vars from analysis using configuration options or a persistent ignore file.
- Configurable analysis – select individual files or directories and control how unused definitions are identified.
- Aggressive mode – repeat analysis until no additional unused vars are detected.
- Reporting – produce text, EDN or ignore-list output for reviewing analysis results.
- CI integration – detect unused code in automated pipelines and return a failure status when problems are found.
- Alternative output directory – write modified files to a separate location instead of overwriting the originals.
- Cross-platform support – runs on Linux, macOS, and Windows.
Website: github.com/borkdude/carve
Support:
Developer: Michiel Borkent
License: Eclipse Public License v1.0
Carve is written in Clojure. Learn Clojure with our recommended free books and free tutorials.
Related Software
| Clojure Linter Tools | |
|---|---|
| kibit | Static code analyzer for Clojure, ClojureScript, cljx and other Clojure variants |
| Joker | Small Clojure interpreter, linter and formatter |
| eastwood | Inspects namespaces and reports possible problems |
| clj-kondo | Static analyzer and linter for Clojure |
| Splint | Focuses on style and code shape |
| Yagni | Leiningen plugin for finding dead code |
| lein-bikeshed | Leiningen plugin |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.