flycheck / flycheck

On the fly syntax checking for GNU Emacs
https://www.flycheck.org
GNU General Public License v3.0
2.4k stars 449 forks source link

Suspicious state from syntax checker r-lintr: Flycheck checker r-lintr returned 1, but its output contained no errors #1991

Open solmos opened 1 year ago

solmos commented 1 year ago

Bug description

I get the following error anytime I am typing inside the argument parentheses in a function definition in an R script:

Suspicious state from syntax checker r-lintr: Flycheck checker r-lintr returned 1, but its output contained no errors: Error in rep.int(character, length) : invalid 'times' value
Calls: <Anonymous> ... print.lint -> cat -> highlight_string -> fill_with -> paste0
In addition: Warning messages:
1: In readLines(obj) :
  incomplete final line found on '/private/var/folders/gx/vdqbfzvs66b1swy4qv7pch7c0000gp/T/flycheckxgcutS/test.R'
2: In readLines(obj) :
  incomplete final line found on '/private/var/folders/gx/vdqbfzvs66b1swy4qv7pch7c0000gp/T/flycheckxgcutS/test.R'
Execution halted

Try installing a more recent version of r-lintr, and please open a bug report if the issue persists in the latest release.  Thanks!

Steps to reproduce

Steps to reproduce the behavior:

  1. Open file test.R

  2. Type:

foo <- function()
  1. Place cursor (in insert mode using evil-mode) inside the parentheses.

Screenshots

Screenshot 2023-01-05 at 13 39 03

System configuration

Syntax checkers for buffer test.R in ess-r-mode:

First checker to run:

  r-lintr
    - may enable:    yes
    - may run:       t
    - executable:    Found at /usr/local/bin/R
    - lintr library: present

Flycheck Mode is enabled. Use SPC u C-c ! x to enable disabled checkers.

--------------------

Flycheck version: 32snapshot
Emacs version:    28.2
System:           aarch64-apple-darwin21.6.0
Window system:    mac

Emacs configuration: Doom Emacs

teotenn commented 1 year ago

I was having same problem as you, without the middle part of In addition: Warning messages:

Try checking the syntax of your .lintr file. Flycheck is very special for the syntax. For example in my case I was trying something like this

(setq tt/lintr-linters
      "linters_with_defaults(
         line_length_linter = line_length_linter(120)
       )"
 )

(setq flycheck-lintr-linters tt/lintr-linters))

Something that with Flymake kind of makes sense and works. But Flycheck keeps sending me the same error as you got. So changed it for (setq flycheck-lintr-linters "linters_with_defaults(line_length_linter = line_length_linter(120))")) and now Flycheck is working.

For the mainteiners, is there a reason why, when I set a variable with spaces flycheck does not recognize it? Flymake had no problems recognizing it.