Formatting and linting code and documents
NUMBAT seminar
Consistently formatted source is easier to read, review and diff, and linters alert you to problems before they become bugs. I will survey and demonstrate the current generation of fast, opinionated formatters and linters — mostly written in Rust, and usable from the command line or from within Positron (and in some cases from RStudio). I’ll focus on air for R and panache for Quarto and R Markdown. If time, I might also mention jarl for R linting, ruff for Python, tex-fmt and chktex for LaTeX, and vale for prose (checking manuscripts against a style guide). I’ll show how to use TOML configuration and format-on-save, so that your code and documents stay tidy with no ongoing effort.
R
- Google style guide
- Tidyverse style guide
- styler: R code formatting
- formatR: R code formatting
- air: R code formatting
- Jarl: R code linting
Python
- Ruff: Python linting and formatting
Quarto and Rmarkdown
- Panache: Markdown, quarto and Rmarkdown linting and formatting
LaTeX
- latexindent: LaTeX formatting
- tex-fmt: LaTeX formatting
- chktex: LaTeX linting