Note: This vignette is best viewedonline, wherewe 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 thatwindow: click “Code” on the left; click “Diagnostics” tab; check “Showdiagnostics for R”.
To lint a source filetest.R type in the Consolelintr::lint("test.R") and look at the result in the“Markers” pane.
This package also includes two addins for linting the current sourceand package. To bind the addin to a keyboard shortcut navigate to Tools> addins > Browse Addins > Keyboard Shortcuts. It’s recommendedto use Alt+Shift+L for linting the current source lint andCtrl+Shift+Alt+L to code the package. These are easy to remember as youare Alt+Shift+L(int) ;)
lintr hasbuilt-inintegration withflycheck versionsgreater than0.23.
lintr is fully integrated into flycheck when usingESS. See the installationdocumentation for those packages for more information.
You can also configure what linters are used. e.g. using a differentline length cutoff. -M-x customize-option ->flycheck-lintr-linters ->linters_with_defaults(line_length_linter(120))
lintr can be integrated withsyntastic foron-the-fly linting.
Put the filesyntastic/lintr.viminsyntastic/syntax_checkers/r. If you are usingpathogen this directoryis~/.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 = 1let g:syntastic_r_checkers = ['lintr']You can also configure what linters are used. e.g. using a differentline length cutoff.
let g:syntastic_r_lintr_linters = "linters_with_defaults(line_length_linter(120))"lintr can be integrated withALE for on the flylinting.
lintr is integrated with ALE and requires no additionalinstallation.
You can configure what linters are used, e.g. using a different linelength cutoff.
let g:ale_r_lintr_options = "linters_with_defaults(line_length_linter(120))"You can also configure whetherlint orlint_package is used. Set to 1 forlint_package and 0 (default) forlint.
let g:ale_r_lintr_lint_package = 1See:h ale_r_lintr for more information.
Note that configuration through.lintr files are notsupported.
There is a work around that can be used to read the contents of a.lintr file in the root of the working directory. Thiswould allow the use of configuration through.lintrfiles.
if filereadable(".lintr") let g:ale_r_lintr_options = join(readfile('.lintr'))endiflintr can be integrated withSublime Linterfor on-the-fly linting.
Simply installsublimeLinter-contrib-lintr usingPackage Control.
For more information seeSublimeLinter Docs
lintr can be integrated withLinter for on the flylinting.
Simply installlinter-lintr from within Atom or on thecommand line with:
For more information and bug reports seeAtomlinter-lintr.
In Visual Studio Code,vscode-Rpresents the lintr diagnostics fromlanguageserver.