talira

Static code analysis and style checking for R

open sourceMITfree

lintr is a linter for R: it checks code against a style, finds syntax errors and possible semantic problems, and reports them. Linters are chosen in a configuration file, it runs in continuous integration (usethis generates a GitHub Actions workflow) and on the fly in RStudio, VS Code, Emacs, Vim and Sublime Text, and it complements the styler package, which restyles code automatically.

Problems it solves

  • lint R code in CI
  • enforce the tidyverse style guide in an R package
  • find possible bugs in R scripts before running them

Features

  • style, syntax and semantic checks for R
  • configurable linters
  • GitHub Actions workflow through usethis
  • editor integration for RStudio, VS Code, Emacs, Vim and Sublime Text

Alternatives

The same job

These do what lintr does.

  1. ShellCheck A shell script static analysis tool
  2. golangci-lint Fast linters runner for Go
  3. Clippy The official Rust linter: 800+ lints for common mistakes and unidiomatic code
  4. RuboCop RSpec RuboCop extension with cops for RSpec test files
  5. Vale A markup-aware linter for prose
  6. PHPCompatibility PHP_CodeSniffer sniffs that check PHP code for cross-version compatibility

Compare lintr with the top 3