Commit ee1cafe5 authored by David Holm's avatar David Holm Committed by Sebastian Wiesner

Add R syntax checker using lintr

parent 2459600a
......@@ -20,6 +20,7 @@
(depends-on "d-mode")
(depends-on "elixir-mode")
(depends-on "erlang")
(depends-on "ess")
(depends-on "go-mode")
(depends-on "haml-mode")
(depends-on "handlebars-mode")
......
......@@ -521,6 +521,12 @@ Python
.. _flycheck-pyflakes: https://github.com/Wilfred/flycheck-pyflakes
R
=
.. flyc-checker:: r-lintr
:auto:
Racket
======
......
......@@ -220,6 +220,7 @@ attention to case differences."
python-flake8
python-pylint
python-pycompile
r-lintr
racket
rpm-rpmlint
rst
......@@ -6587,6 +6588,24 @@ See URL `https://docs.python.org/3.4/library/py_compile.html'."
line ", " column ", " (one-or-more not-newline) line-end))
:modes python-mode)
(flycheck-define-checker r-lintr
"An R style and syntax checker using the lintr package.
See URL `http://cran.r-project.org/web/packages/lintr/'."
:command ("R" "--slave" "--restore" "--no-save" "-e"
(eval (concat
"library(lintr);"
"try(lint(commandArgs(TRUE), default_linters))"))
"--args" source)
:error-patterns
((info line-start (file-name) ":" line ":" column ": style: " (message)
line-end)
(warning line-start (file-name) ":" line ":" column ": warning: " (message)
line-end)
(error line-start (file-name) ":" line ":" column ": error: " (message)
line-end))
:modes ess-mode)
(flycheck-define-checker racket
"A Racket syntax checker using the Racket compiler.
......
......@@ -57,6 +57,9 @@
(autoload 'coq-mode "coq")
;; Load ESS for R-mode (its autoloads are broken)
(require 'ess-site nil 'noerror)
;;; Directories
......@@ -4660,6 +4663,14 @@ Why not:
(flycheck-ert-should-syntax-check
"checkers/python/test.py" 'python-mode)))
(flycheck-ert-def-checker-test r-lintr r nil
(flycheck-ert-should-syntax-check
"checkers/r-lintr.R" 'R-mode
'(1 28 info "Opening curly braces should never go on their own line and should always be followed by a new line."
:checker r-lintr)
'(4 6 warning "Do not use absolute paths." :checker r-lintr)
'(7 5 error "unexpected end of input" :checker r-lintr)))
(flycheck-ert-def-checker-test racket racket nil
(flycheck-ert-should-syntax-check
"checkers/racket-syntax-error.rkt" 'racket-mode
......
a <- function(file, b = 2) {cat("Hello World!\\n", file=file)
}
b <- function() {
"/absolute/path/to/file"
}
b <- function() {
b
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment