talira

Background code checker

open sourceAGPL-3.0self-hostablefree

bacon is a background code checker for Rust that you leave running in a terminal beside your editor. It finds the source directories from Cargo.toml, reruns cargo check on every change and shows errors before warnings, the first ones first, so a small pane is enough. One key switches the job to clippy, the tests (or cargo-nextest), the docs or a job of your own from bacon.toml, and f narrows a test run to the failing test. A job can run a server and kill and restart it on each change, and analyzers read Go, C++, Python, ESLint, Biome, TypeScript and Swift output too. It's the tool cargo-watch's maintainer recommends in its place.

Ways to install

Problems it solves

  • see my Rust compiler errors in a side terminal as I edit, without typing cargo check
  • cargo check output scrolls away and I have to scroll up to find the first error
  • rerun only the failing Rust test each time I save
  • switch between cargo check, clippy and the tests with one key while I code
  • keep clippy warnings visible all the time while I write Rust
  • restart my Rust web server automatically when I change the code
  • a replacement for cargo watch now that it's no longer maintained
  • check my Rust code for another target such as Windows on every change
  • a compact list of Rust errors and warnings that fits a small terminal pane
  • get background cargo check diagnostics into Neovim or my editor through a language server
  • rerun pytest, ruff or eslint on save and list only the failures

Features

  • errors before warnings, first errors first
  • jobs for check, clippy, test, nextest, doc and run, switched with one key
  • custom jobs and key bindings in bacon.toml and prefs.toml
  • f restricts the test job to the failing test
  • kill_then_restart strategy and custom kill command for servers
  • headless mode without the TUI
  • remote control over a socket (listen, bacon --send)
  • exports locations for editors: bacon-ls, nvim-bacon, emacs-bacon
  • analyzers for Go, C++ (GCC, Clang, doctest), pytest, Ruff, unittest, Biome, ESLint, tsc and Swift
  • summary, wrap and reverse modes
View 1 more
  • shell completion for bash, zsh, fish, elvish and PowerShell

Limitations

  • Doesn't fully support languages other than Rust yet: its docs call the Go, C++, Python, ESLint, TypeScript and Swift analyzers young3

Capabilities

Has a command line toolplan not known

Alternatives

The same job

These do what bacon does.

  1. watchexec Executes commands in response to file modifications
  2. entr Run arbitrary commands when files change

Compare bacon with the top 3