summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-03 22:34:22 +0100
committerw0rp <devw0rp@gmail.com>2017-07-03 22:34:30 +0100
commita1cf7f67a10b03e40596b2c48a2cbe11d9ce38a4 (patch)
tree521ea7076155bcf1c59e2acc01f4d2c666453ae0
parent638eb1f000446eb4063d31d23b13bcc47b20842e (diff)
downloadale-a1cf7f67a10b03e40596b2c48a2cbe11d9ce38a4.zip
Fix #182 - Add support for lintr
-rw-r--r--README.md1
-rw-r--r--ale_linters/r/lintr.vim15
-rw-r--r--doc/ale.txt1
3 files changed, 17 insertions, 0 deletions
diff --git a/README.md b/README.md
index e94c1cfa..6358bc0a 100644
--- a/README.md
+++ b/README.md
@@ -103,6 +103,7 @@ name. That seems to be the fairest way to arrange this table.
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
| Python | [autopep8](https://github.com/hhatto/autopep8), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [pylint](https://www.pylint.org/), [yapf](https://github.com/google/yapf) |
+| R | [lintr](https://github.com/jimhester/lintr) |
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-reason-merlin` for configuration instructions
| reStructuredText | [proselint](http://proselint.com/)|
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
diff --git a/ale_linters/r/lintr.vim b/ale_linters/r/lintr.vim
new file mode 100644
index 00000000..9375b8a5
--- /dev/null
+++ b/ale_linters/r/lintr.vim
@@ -0,0 +1,15 @@
+" Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com>
+" Description: This file adds support for checking R code with lintr.
+
+function! ale_linters#r#lintr#GetCommand(buffer) abort
+ return ale#path#BufferCdString(a:buffer)
+ \ . 'Rscript -e ' . ale#Escape('lintr::lint(commandArgs(TRUE))') . ' %t'
+endfunction
+
+call ale#linter#Define('r', {
+\ 'name': 'lintr',
+\ 'executable': 'Rscript',
+\ 'command_callback': 'ale_linters#r#lintr#GetCommand',
+\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
+\ 'output_stream': 'both',
+\})
diff --git a/doc/ale.txt b/doc/ale.txt
index ad32619a..0a31fca1 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -194,6 +194,7 @@ The following languages and tools are supported.
* Pug: 'pug-lint'
* Puppet: 'puppet', 'puppet-lint'
* Python: 'autopep8', 'flake8', 'isort', 'mypy', 'pylint', 'yapf'
+* R: 'lintr'
* ReasonML: 'merlin'
* reStructuredText: 'proselint'
* RPM spec: 'spec'