|
27 | 27 | ;; Flymake is the built-in Emacs package that supports on-the-fly |
28 | 28 | ;; syntax checking. This file adds support for this in ess-r-mode by |
29 | 29 | ;; relying on the lintr package, available on CRAN and currently |
30 | | -;; hosted at https://github.com/jimhester/lintr. |
| 30 | +;; hosted at https://github.com/r-lib/lintr. |
31 | 31 |
|
32 | 32 | ;;; Code: |
33 | 33 |
|
@@ -76,28 +76,26 @@ each element is passed as argument to `lintr::linters_with_defaults'." |
76 | 76 | (defvar-local ess-r--flymake-proc nil) |
77 | 77 |
|
78 | 78 | (defvar-local ess-r--lintr-file nil |
79 | | - "Location of the .lintr file for this buffer.") |
| 79 | + "Location of the .lintr config file for this buffer.") |
80 | 80 |
|
81 | 81 | (defvar ess-r--flymake-def-linter |
82 | 82 | (replace-regexp-in-string |
83 | 83 | "[\n\t ]+" " " |
84 | 84 | "esslint <- function(str, ...) { |
85 | | - if (!suppressWarnings(require(lintr, quietly=T))) { |
| 85 | + if (!suppressWarnings(requireNamespace('lintr', quietly=TRUE))) { |
86 | 86 | cat('@@error: @@`lintr` package not installed') |
| 87 | + } else if (packageVersion('lintr') <= '3.0.0') { |
| 88 | + cat('@@error: @@Need `lintr` version > v3.0.0') |
87 | 89 | } else { |
88 | | - if (packageVersion('lintr') <= '3.0.0') { |
89 | | - cat('@@error: @@Need `lintr` version > v3.0.0') |
90 | | - } else { |
91 | | - tryCatch(lintr::lint(commandArgs(TRUE), ...), |
92 | | - error = function(e) { |
93 | | - cat('@@warning: @@', conditionMessage(e)) |
94 | | - }) |
95 | | - } |
| 90 | + tryCatch(lintr::lint(text=commandArgs(TRUE), ..., parse_settings=TRUE), |
| 91 | + error = function(e) { |
| 92 | + cat('@@warning: @@', conditionMessage(e)) |
| 93 | + }) |
96 | 94 | } |
97 | 95 | };")) |
98 | 96 |
|
99 | 97 | (defun ess-r--find-lintr-file () |
100 | | - "Return the absolute path to the .lintr file. |
| 98 | + "Return the absolute path to the .lintr config file. |
101 | 99 | Check first the current directory, then the project root, then |
102 | 100 | the package root, then the user's home directory. Return nil if |
103 | 101 | we couldn't find a .lintr file." |
|
0 commit comments