Note: This vignette is best viewed online, where we can render full animations of editor flows.
lintr lints are automatically displayed in the RStudio Markers pane (RStudio versions > v0.99.206).
In order to show the “Markers” pane in RStudio: Menu “Tools” -> “Global Options…”, a window with title “Options” will pop up. In that window: click “Code” on the left; click “Diagnostics” tab; check “Show diagnostics for R”.
To lint a source file test.R
type in the Console lintr::lint("test.R")
and look at the result in the “Markers” pane.
This package also includes two addins for linting the current source and package. To bind the addin to a keyboard shortcut navigate to Tools > addins > Browse Addins > Keyboard Shortcuts. It’s recommended to use Alt+Shift+L for linting the current source lint and Ctrl+Shift+Alt+L to code the package. These are easy to remember as you are Alt+Shift+L(int) ;)
lintr has built-in integration with flycheck versions greater than 0.23
.
lintr is fully integrated into flycheck when using ESS. See the installation documentation for those packages for more information.
You can also configure what linters are used. e.g. using a different line length cutoff. - M-x customize-option
-> flycheck-lintr-linters
-> linters_with_defaults(line_length_linter(120))
lintr can be integrated with syntastic for on-the-fly linting.
Put the file syntastic/lintr.vim in syntastic/syntax_checkers/r
. If you are using pathogen this directory is ~/.vim/bundles/syntastic/syntax_checkers/r
.
You will also need to add the following lines to your .vimrc
.
let g:syntastic_enable_r_lintr_checker = 1
let g:syntastic_r_checkers = ['lintr']
You can also configure what linters are used. e.g. using a different line length cutoff.
let g:syntastic_r_lintr_linters = "linters_with_defaults(line_length_linter(120))"
lintr can be integrated with ALE for on the fly linting.
lintr is integrated with ALE and requires no additional installation.
You can configure what linters are used, e.g. using a different line length cutoff.
let g:ale_r_lintr_options = "linters_with_defaults(line_length_linter(120))"
You can also configure whether lint
or lint_package
is used. Set to 1 for lint_package
and 0 (default) for lint
.
let g:ale_r_lintr_lint_package = 1
See :h ale_r_lintr
for more information.
Note that configuration through .lintr
files are not supported.
lintr can be integrated with Sublime Linter for on-the-fly linting.
Simply install sublimeLinter-contrib-lintr
using Package Control.
For more information see Sublime Linter Docs
You can also configure what linters are used. e.g. disabling the assignment linter and using a different line length cutoff. In the SublimeLinter User Settings
{
"linters": {
"lintr": {
"linters": "linters_with_defaults(assignment_linter = NULL, line_length_linter(120))"
}
}
}
lintr can be integrated with Linter for on the fly linting.
Simply install linter-lintr
from within Atom or on the command line with:
apm install linter-lintr
For more information and bug reports see Atom linter-lintr.
In Visual Studio Code, vscode-R presents the lintr diagnostics from languageserver.
Installing languageserver
package in R and vscode-R
extension in VS Code will enable lintr in VS Code by default or run the following command lines:
Rscript -e 'install.packages("languageserver")'
code --install-extension reditorsupport.r